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!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Merge Problem
  FAQ FAQ  Forum Search   Register Register  Login Login

Merge Problem

 Post Reply Post Reply
Author
Message
Supertension View Drop Down
Beginner
Beginner
Avatar

Joined: 29 Aug 12
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote Supertension Quote  Post ReplyReply Direct Link To This Post Topic: Merge Problem
    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
Back to Top
jpbro View Drop Down
Senior Member
Senior Member


Joined: 29 Mar 11
Status: Offline
Points: 77
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 29 Aug 12 at 2:04PM
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
Back to Top
Supertension View Drop Down
Beginner
Beginner
Avatar

Joined: 29 Aug 12
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote Supertension Quote  Post ReplyReply Direct Link To This Post Posted: 29 Aug 12 at 3:16PM
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. 
Back to Top
Rowan View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 10 Jan 09
Status: Offline
Points: 398
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rowan Quote  Post ReplyReply Direct Link To This Post Posted: 29 Aug 12 at 3:50PM
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.
Back to Top
Supertension View Drop Down
Beginner
Beginner
Avatar

Joined: 29 Aug 12
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote Supertension Quote  Post ReplyReply Direct Link To This Post Posted: 29 Aug 12 at 3:53PM
Rowan,  Noted.  I'll make sure I don't include it in any future posts.
 
Can you help me solve my problem?  Thanks
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 29 Aug 12 at 3:56PM
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
Back to Top
Supertension View Drop Down
Beginner
Beginner
Avatar

Joined: 29 Aug 12
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote Supertension Quote  Post ReplyReply Direct Link To This Post Posted: 29 Aug 12 at 4:01PM
Andrew,  Thanks but no joy.  I still get the syntax error.
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 29 Aug 12 at 4:15PM
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
Back to Top
Supertension View Drop Down
Beginner
Beginner
Avatar

Joined: 29 Aug 12
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote Supertension Quote  Post ReplyReply Direct Link To This Post Posted: 29 Aug 12 at 6:48PM
Andrew,  Perfect.  Many thanks for your help.  I would never have worked that one out for myself.
Back to Top
isyscorp View Drop Down
Beginner
Beginner
Avatar

Joined: 30 Aug 12
Location: Philippines
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote isyscorp Quote  Post ReplyReply Direct Link To This Post Posted: 30 Aug 12 at 1:31AM
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
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 30 Aug 12 at 3:27AM

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.
Back to Top
isyscorp View Drop Down
Beginner
Beginner
Avatar

Joined: 30 Aug 12
Location: Philippines
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote isyscorp Quote  Post ReplyReply Direct Link To This Post Posted: 31 Aug 12 at 12:28AM
Hi Andrew, thank for your help. It runs without error now. I want to put the merge command to a BUTTON? Thanks again...
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 31 Aug 12 at 7:53PM
..."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
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 02 Sep 12 at 8:07AM
"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.
Back to Top
isyscorp View Drop Down
Beginner
Beginner
Avatar

Joined: 30 Aug 12
Location: Philippines
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote isyscorp Quote  Post ReplyReply Direct Link To This Post Posted: 02 Sep 12 at 12:35PM
Thanks Andrew, it works now... you're a life saver... 

Vid.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store