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 and PDF with 132 form fields
  FAQ FAQ  Forum Search   Register Register  Login Login

Merge and PDF with 132 form fields

 Post Reply Post Reply
Author
Message
niklashemdal View Drop Down
Beginner
Beginner


Joined: 02 Mar 12
Location: Washington, DC
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote niklashemdal Quote  Post ReplyReply Direct Link To This Post Topic: Merge and PDF with 132 form fields
    Posted: 02 Mar 12 at 12:42PM
I am using 7.x ActiveX with VB6 to merge PDF forms.  i.e.

    Dim d1 As Long
    Dim d2 As Long
    Dim resultCode As Long
    Dim pdfLibL As QuickPDFAX0719.PDFLibrary
    Set pdfLibL = New QuickPDFAX0719.PDFLibrary
    Call pdfLibL.LoadFromFile(fileNameMs$)
    d1 = pdfLibL.SelectedDocument()
    Call pdfLibL.LoadFromFile(newTemplateLs$)
    d2 = pdfLibL.SelectedDocument()
    Call pdfLibL.SelectDocument(d1)
    Call pdfLibL.MergeDocument(d2)
    resultCode = pdfLibL.SaveToFile(newFileNameLs$)

This code is called in a loop, where the file saved (newFileNameLs$) becomes d1 for the next iteration.  I have also tried usnig MergeFiles API, but get the same end result.  MergeFiles had a better result - I was able to add more pages but still crashed.  One PDF has 132 form fields.  I will see what flattening d1  form fields does in the merge process.   MergeFiles dies at about 7524 form fields with "Application-defined or object-defined error"

Back to Top
niklashemdal View Drop Down
Beginner
Beginner


Joined: 02 Mar 12
Location: Washington, DC
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote niklashemdal Quote  Post ReplyReply Direct Link To This Post Posted: 02 Mar 12 at 1:04PM
Now, if I change code to:
    Dim d1 As Long
    Dim d2 As Long
    Dim resultCode As Long
    Dim FieldIndex As Integer
    Dim FieldCount As Integer
    Dim LoopNumber As Integer
   
    Dim pdfLibL As QuickPDFAX0719.PDFLibrary
    Set pdfLibL = New QuickPDFAX0719.PDFLibrary
    Call pdfLibL.UnlockKey("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
   
    Call pdfLibL.LoadFromFile(fileNameMs$)
    FieldCount = pdfLibL.FormFieldCount()
    FieldIndex = 1
    For LoopNumber = 1 To FieldCount
      If pdfLibL.FlattenFormField(FieldIndex) = 0 Then
        FieldIndex = FieldIndex + 1
      End If
    Next
    d1 = pdfLibL.SelectedDocument()
    Call pdfLibL.LoadFromFile(newTemplateLs$)
    d2 = pdfLibL.SelectedDocument()
    Call pdfLibL.SelectDocument(d1)
    Call pdfLibL.MergeDocument(d2)
    resultCode = pdfLibL.SaveToFile(newFileNameLs$)

I no longer receive the Applicatio-defined or object-defined fatal error; however, my resultant PDF only contains pages 65 to 76.


Edited by niklashemdal - 02 Mar 12 at 1:15PM
Back to Top
niklashemdal View Drop Down
Beginner
Beginner


Joined: 02 Mar 12
Location: Washington, DC
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote niklashemdal Quote  Post ReplyReply Direct Link To This Post Posted: 02 Mar 12 at 1:09PM
The PDF I am using is here - http://www.box.com/s/m46gv1j67lzrcfixs2h3
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: 06 Mar 12 at 11:31AM

When you flatten form fields you need to flatten them backwards.

For LoopNumber = FieldCount downto 1     ' <<<<<<<<<
      If pdfLibL.FlattenFormField(FieldIndex) = 0 Then
        FieldIndex = FieldIndex + 1
      End If
    Next

Also you may want to try upgrading to the 7.26 release which contains many bug fixes compared to 7.16.  The 7.26 version is a free upgrade for all 7.xx users and can be downloaded from

http://www.quickpdflibrary.com/downloads/binaries/qp/oldversions/0726/quick_pdf_library726.exe

Andrew.
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