Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
![]() |
Merge Problem |
Post Reply ![]() |
Author | |
Supertension ![]() Beginner ![]() ![]() Joined: 29 Aug 12 Status: Offline Points: 11 |
![]() ![]() ![]() ![]() ![]() Posted: 29 Aug 12 at 1:20PM |
Hi, Can someone help please?
I’m new to all this so please bear with me if I’m doing something daft. I’m
running Windows 7 64 bit. I downloaded the trial version and registered the ActiveX
dll file called “QuickPDFAX0816.dll” without any problems. I then opened Microsoft Access and entered the following VBA
code (which is based on the code given on http://www.quickpdflibrary.com/help/getting-started-activex.php)
and, to my delight, it all ran perfectly and I created my first pdf. The VBA code
is: Public Sub TestQpdf() Set PDFLibrary =
CreateObject("QuickPDFAX0816.PDFLibrary") If
PDFLibrary.UnlockKey("insert_license_key_here") = 1 Then Call
PDFLibrary.DrawText(100, 500, "Test Text") Call
PDFLibrary.SaveToFile("C:\users\DAN\DeskTop\Test.pdf") End If Set PDFLibrary = Nothing End Sub I then tried the code below (which is based on the code
given on http://www.quickpdflibrary.com/tutorials/merge-pdf.php) but it crashes
at the line PDFLibrary.LoadFromFile (Doc1) and the VBA error message is
run-time error’450’: Wrong number of arguments or invalid property assignment. Public Sub TestQpdfMerge() Set PDFLibrary =
CreateObject("QuickPDFAX0816.PDFLibrary") If PDFLibrary.UnlockKey("insert_license_key_here")
= 1 Then Doc1 =
"C:\users\DAN\DeskTop\PDF1.pdf" Doc2 =
"C:\users\DAN\DeskTop\PDF2.pdf" Doc3 =
"C:\users\DAN\DeskTop\PDF3.pdf"
PDFLibrary.LoadFromFile (Doc1) MainDocID =
PDFLibrary.SelectedDocument()
PDFLibrary.LoadFromFile (Doc2) AppendID =
PDFLibrary.SelectedDocument()
PDFLibrary.SelectDocument (MainDocID)
PDFLibrary.MergeDocument (AppendID)
PDFLibrary.SaveToFile (Doc3) End If End Sub I suspect I’m missing the point somewhere and should be
grateful if someone could point me in the right direction, ideally with a few
lines of VBA that will work. Thank you. Edited by Rowan - 29 Aug 12 at 3:58PM |
|
![]() |
|
jpbro ![]() Senior Member ![]() Joined: 29 Mar 11 Status: Offline Points: 77 |
![]() ![]() ![]() ![]() ![]() |
The "wrong number of arguments" error message is a clue - the LoadFromFile documentation mentions that a second argument is required (password). If your PDF file doesn't have a password, then use pass "" as the second parameter (e.g. PDFLibrary.LoadFromFile(Doc1, ""))
The LoadFromFile method changed to include the password parameter when 8.x was released, so the sample code that you have is out of date. There may be other changes too, so it is a good idea to review the documentation for any methods that you are calling. Edited by jpbro - 29 Aug 12 at 2:05PM |
|
![]() |
|
Supertension ![]() Beginner ![]() ![]() Joined: 29 Aug 12 Status: Offline Points: 11 |
![]() ![]() ![]() ![]() ![]() |
Thanks. I've tried what you suggested, i.e. PDFLibrary.LoadFromFile(Doc1, ""), but the line immediately turns red indicating a syntax error. I've read through the documentation but can't see anything to help.
|
|
![]() |
|
Rowan ![]() Moderator Group ![]() ![]() Joined: 10 Jan 09 Status: Offline Points: 398 |
![]() ![]() ![]() ![]() ![]() |
Hi Supertension,
Just in case you're wondering -- I made a small edit to your post to remove the license key from the sample code. Cheers, - Rowan.
|
|
![]() |
|
Supertension ![]() Beginner ![]() ![]() Joined: 29 Aug 12 Status: Offline Points: 11 |
![]() ![]() ![]() ![]() ![]() |
Rowan, Noted. I'll make sure I don't include it in any future posts.
Can you help me solve my problem? Thanks
|
|
![]() |
|
AndrewC ![]() Moderator Group ![]() ![]() Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
![]() ![]() ![]() ![]() ![]() |
Maybe you could try
Password = "" PDFLibrary.LoadFromFile(Doc1, Password); or PDFLibrary.LoadFromFile(Doc1, NullString); This is a VBA problem but I don't have any experience in VBA. Andrew.
Edited by AndrewC - 29 Aug 12 at 4:01PM |
|
![]() |
|
Supertension ![]() Beginner ![]() ![]() Joined: 29 Aug 12 Status: Offline Points: 11 |
![]() ![]() ![]() ![]() ![]() |
Andrew, Thanks but no joy. I still get the syntax error.
|
|
![]() |
|
AndrewC ![]() Moderator Group ![]() ![]() Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
![]() ![]() ![]() ![]() ![]() |
It seems that you need to store the return value. The VBA error message didn't help much. What a strange language. Andrew. Sub Help() Set PDFLibrary = CreateObject("QuickPDFAX0816.PDFLibrary") If PDFLibrary.UnlockKey("put your key here") = 1 Then Doc1 = "f:\downloads\1.pdf" Doc2 = "f:\downloads\2.pdf" Doc3 = "f:\downloads\vba.pdf" ret = PDFLibrary.LoadFromFile(Doc1, NullString) // Works MainDocID = PDFLibrary.SelectedDocument() ret = PDFLibrary.LoadFromFile(Doc2, "") // Works AppendID = PDFLibrary.SelectedDocument() PDFLibrary.SelectDocument (MainDocID) // strange it doesn't need the return value here. PDFLibrary.MergeDocument (AppendID) PDFLibrary.SaveToFile (Doc3) End If End Sub Edited by AndrewC - 29 Aug 12 at 4:26PM |
|
![]() |
|
Supertension ![]() Beginner ![]() ![]() Joined: 29 Aug 12 Status: Offline Points: 11 |
![]() ![]() ![]() ![]() ![]() |
Andrew, Perfect. Many thanks for your help. I would never have worked that one out for myself.
|
|
![]() |
|
isyscorp ![]() Beginner ![]() ![]() Joined: 30 Aug 12 Location: Philippines Status: Offline Points: 19 |
![]() ![]() ![]() ![]() ![]() |
Hi Rowan,
Been reading and testing most of your Delphi Sample how to merge Multiple PDF files into one. I am now using a trial version of the Quick PDF Library. Regarding your PDF Merging via Stream, i cannot make it work. uses ***QuickPDF0816; function MergeStreamsViaMergeDocument(FirstStream, SecondStream, OutputStream: TMemoryStream): Integer; var doc1, doc2: Integer; begin with TQuickPDF.Create do try FirstStream.Seek(0, soFromBeginning); LoadFromStream(FirstStream); doc1 := SelectedDocument; SecondStream.Seek(0, soFromBeginning); LoadFromStream(SecondStream); doc2 := SelectedDocument; SelectDocument(doc1); MergeDocument(doc2); OutputStream.Seek(0, soFromBeginning); SaveToStream(OutputStream); finally Free; end; end; ERROR MESSAGE APPEARED ON: " LoadFromStream(FirstStream);" ERROR MESSAGE: "NOT ENOUGH ACTUAL PARAMETERS." Please help. Thank you in advance. Vid, MULTISYSCORP
|
|
![]() |
|
AndrewC ![]() Moderator Group ![]() ![]() Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
![]() ![]() ![]() ![]() ![]() |
A quick read of the "Quick PDF Library 8.16 Reference Guide.pdf" will reveal that LoadFromStream also requires a password parameter as of QPL 8.xx. The PDF file can be found in the Quick PDF installation directory. LoadFromStream(FirstStream, Password); // add the password parameter - can be blank ie. "" It would also be helpful to know what development system you are using. Andrew.
|
|
![]() |
|
isyscorp ![]() Beginner ![]() ![]() Joined: 30 Aug 12 Location: Philippines Status: Offline Points: 19 |
![]() ![]() ![]() ![]() ![]() |
Hi Andrew, thank for your help. It runs without error now. I want to put the merge command to a BUTTON? Thanks again...
|
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
..."to a BUTTON"...
You'll find it here: http://www.quickpdf.org/forum/forum_posts.asp?TID=2391&PID=10058&title=merging-2-or-more-pdf-files-into-One-pdf-file#10058 Cheers, Ingo |
|
![]() |
|
AndrewC ![]() Moderator Group ![]() ![]() Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
![]() ![]() ![]() ![]() ![]() |
"to a BUTTON" is a Delphi problem and not a Quick PDF Library. This is one of the very first things that is taught in any Delphi Basics 101 course. ie
http://www.delphibasics.co.uk/Article.asp?Name=FirstPgm
1. Add a button to your form 2. Double click the button and the following code is shown procedure TForm1.Button1Click(Sender: TObject); begin end; 3. Paste the Quick PDF Library code we have given you between the 'begin' and 'end' statements. Andrew.
|
|
![]() |
|
isyscorp ![]() Beginner ![]() ![]() Joined: 30 Aug 12 Location: Philippines Status: Offline Points: 19 |
![]() ![]() ![]() ![]() ![]() |
Thanks Andrew, it works now... you're a life saver...
Vid.
|
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store