Missing form field content after merging PDF documents

Discussions about PDF management.
Post Reply
msie
Posts: 1
Joined: Mon Jun 06, 2016 11:15 am

Missing form field content after merging PDF documents

Post by msie » Mon Jun 06, 2016 11:32 am

Hi,

after merging two PDF documents by using MergeDocuments(GDPicturePDF[]) the form field contents of the second PDF document were missing in the output file.
When merging three documents the form field contents of the last two documents were missing.
The contents of the first page's form fields where always retained in the output file.

Applying SetFormFieldVisibility() to every field in each document didn't change anything.

Thanks for your support!

Code: Select all

        public GdPicturePDF Merge(GdPicturePDF[] inputFiles, string outputFile)
        {
            GdPicturePDF mergedFile = new GdPicturePDF();
            var output = mergedFile.MergeDocuments(inputFiles);
          
            int i = 0;
            int formFieldId = output.GetFormFieldId(i);
            while (i < output.GetFormFieldsCount())
            {                               
                output.SetFormFieldVisibility(formFieldId, PdfFormFieldVisibility.PdfFormFieldVisible);
                formFieldId = output.GetFormFieldId(i++);
            }

            output.SaveToFile(outputFile);
            output.CloseDocument();

            return output;
        }

delbeke
Posts: 89
Joined: Wed Oct 31, 2012 5:07 pm

Re: Missing form field content after merging PDF documents

Post by delbeke » Wed Jun 08, 2016 12:10 pm

Hi Msie

I can not reproduce the problem on our side.
The code you show can not be run as this.

Look at this sample code to control your own

GdPicturePDF[] pdfImports = new GdPicturePDF[3] ;

pdfImports[0] = new GdPicturePDF();
pdfImports[1] = new GdPicturePDF();
pdfImports[2] = new GdPicturePDF();
pdfImports[0].LoadFromFile(@"D:\PDFs\FormFields\1.pdf", true);
pdfImports[1].LoadFromFile(@"D:\PDFs\FormFields\2.pdf", true);
pdfImports[2].LoadFromFile(@"D:\PDFs\FormFields\3.pdf", true);
GdPicturePDF outPdf = new GdPicturePDF().MergeDocuments(pdfImports);
var lStatus = outPdf.GetStat();
outPdf.SaveToFile(@"D:\PDFs\FormFields\testMerge.pdf");
MessageBox.Show("Done " + lStatus.ToString());

Hoping this help

Jean-Luc

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests