Print Page | Close Window

Merging PDF Pages: Empty FormFields

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=4044
Printed Date: 25 Apr 25 at 12:33PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Merging PDF Pages: Empty FormFields
Posted By: Skandinavier
Subject: Merging PDF Pages: Empty FormFields
Date Posted: 20 Jan 25 at 7:20PM
Hi everyone,

I’m working on merging two or more PDF pages into a single page using the "DrawCapturedPage" function. This works fine overall, but I’ve run into a problem:

The form fields that I previously filled using "SetFormFieldValueByTitle" remain empty in the merged PDF page.

Does anyone have an idea how I can ensure that the contents of the form fields are retained when merging the pages?

Thanks in advance for your help! 




Replies:
Posted By: Ingo
Date Posted: 20 Jan 25 at 11:17PM
Hi :)

It's necessary that each form field has a unique name. If you put several pages with form fields on a new single page you should have an eye on this fact if you don't want to run into problems.
Another point: What type of form fields you're using? Acro or xfa? QuickPDF doesn't offer much support using xfa.



-------------
Cheers,
Ingo



Posted By: Skandinavier
Date Posted: 21 Jan 25 at 10:18AM
Hi Ingo,

Thank you for your answer.

It doesn't work even with a single field (I tested it to rule out potential issues with duplicate names).
The form was originally created with LibreOffice. How can I find out the type of the form fields?
I am using the DebenuPDFLibraryDLL1811.
If merging the pages doesn't work this way, I’m considering how to place all fields on one page and delete the unnecessary ones before saving/printing.

Greetings


Posted By: noramila
Date Posted: 23 Jan 25 at 1:17PM
Hi @Skandinavier,
Try flattening the form fields (turning them into static content) before merging. This should keep the filled values. You can check if the fields are AcroForm or XFA using Adobe Acrobat. If flattening doesn’t work, copy the fields to a new page first.



Posted By: Ingo
Date Posted: 23 Jan 25 at 9:23PM
With
//...
if (QP.GetXFAFormFieldCount > 0) or (QP.FormFieldCount > 0) then...
//...
you can check if there are acro form fields or xfa form fields.



-------------
Cheers,
Ingo



Posted By: noramila
Date Posted: 24 Jan 25 at 12:19PM
Thankyou For the info.


Posted By: Skandinavier
Date Posted: 31 Jan 25 at 9:57AM
Hello everyone,

The fields are AcroForm.

I choose to define all possible fields and remove the unnecessary ones before saving.
However, I'm encountering a strange issue:
When generating the document, I end up with the first page repeated three times—although the same code works perfectly fine with a different template.

Could someone take a look at the code below and help me understand why this is happening?

 Dim fileName As String = "D:\....\...\Template.pdf"

        Dim Final_Doc As Integer
        Dim Used_Doc As Integer

        Call QP.LoadFromFile(fileName, "")

        '1. Page
        Call QP.SetFormFieldValueByTitle("Titel", "First Page")
      
        Final_Doc = QP.SelectedDocument()

        '2. Page

        Call QP.LoadFromFile(fileName, "")

        Call QP.SetFormFieldValueByTitle("Titel", "Second Page")
       
        Used_Doc = QP.SelectedDocument()

        QP.SelectDocument(Final_Doc)
        QP.MergeDocument(Used_Doc)


        '3. Page

        Call QP.LoadFromFile(fileName, "")

        Call QP.SetFormFieldValueByTitle("Titel", "Third Page")
        
        Used_Doc = QP.SelectedDocument()

        QP.SelectDocument(Final_Doc)
        QP.MergeDocument(Used_Doc)


        Call QP.SaveToFile("D:\....\...\Result.pdf")

        ' Remove document from memory
        QP.RemoveDocument(Final_Doc)


Thanks in advance!


Posted By: Skandinavier
Date Posted: 03 Feb 25 at 2:38PM
I copied the template using Adobe Reader. With this template, I achieve the desired result with the above code, namely pages 1–3. PDFs truly are a riddle wrapped in a mystery inside an enigma (W. Churchill).



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk