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 and PDF with 132 form fields |
Post Reply ![]() |
Author | |
niklashemdal ![]() Beginner ![]() Joined: 02 Mar 12 Location: Washington, DC Status: Offline Points: 3 |
![]() ![]() ![]() ![]() ![]() 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" |
|
![]() |
|
niklashemdal ![]() Beginner ![]() Joined: 02 Mar 12 Location: Washington, DC Status: Offline Points: 3 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
niklashemdal ![]() Beginner ![]() Joined: 02 Mar 12 Location: Washington, DC Status: Offline Points: 3 |
![]() ![]() ![]() ![]() ![]() |
The PDF I am using is here - http://www.box.com/s/m46gv1j67lzrcfixs2h3
|
|
![]() |
|
AndrewC ![]() Moderator Group ![]() ![]() Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
![]() ![]() ![]() ![]() ![]() |
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.
|
|
![]() |
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