Product: Windows C# (.Net Core)
Product Version: Latest (9.0.0.77611)
Please give a brief summary of your issue:
After successfully creating a FDFDoc from a xfdf string no pages are added to the PDFDoc.
Please describe your issue and provide steps to reproduce it:
From code I am passed a in house file that needs to be generated into a template PDF. Instead of opening the template pdf I decided to generate a string of xfdf as this can be done very quickly with string builder and the amount of text I am using.
After the xfdf is generated for each line in the file, I run the following lines of code.
var form = new FDFDoc(FDFDoc.CreateFromXFDF(sb.ToString()));
outputPdf.FDFMerge(form);
outputPdf.RefreshFieldAppearances();
outputPdf.FlattenAnnotations();
sb is the string builder stated before and outputPdf is a PDF that was created further up to be open for longer so that multiple “forms” can be added to the single pdf. I have made sure that after ever pages is added that the pdf is refreshed then flattened so the next form page fields do not get mixed up with the previously added forms.
When this section of code is done running (this does not error) it returns the “outputPdf” and then the main function saves the pdf with “e_linearized”. This save action fails with the following error.
When diagnosing this problem, I first tried changing the e_linearized to any other option and it would save, but the pdf had no pages. I then tracked down why no pages were present. I found that the Form when the FDF Merge was called no pages to the outputPdf.
I also tried saving the xfdf file to see if the data was not being created properly, however, it was as not only was the file displaying properly but it also could be double clicked and open the form filled out in Adobe Acrobat DC.
Outside of opening the Template Form as a PDFDoc and filling each field individually and then adding a new page for each line in the file, is there something that could possible be done to get the FDF Merge working. I have to be able to do this PDF generation very quickly and not take up GB of memory which is a tall order. Any help or advice is appriciated.