I have this pdf form (that comes in a portfolio of pdf's) looking for a library solution that will work for what I need. It's easy enough to split the portfolio into pdfs. The problem is one of the forms is a fillable form that when opened in a browser shows as one page with the message "Please wait... If this message is not eventually replaced by the proper contents of the document, your PDF viewer may not be able to display this type of document. ". If I open it up in adobe I can see it's a 3 page form with radio buttons, dropdowns, and text fields all filled in. I can go print to pdf, which then removes all the fillable/editable properties and the filled in form is now viewable in a browser. I want to be able to do that in my application....
I did look through the forums an on a forum for Xamarian.forms I found a snippet of code to test if the pdf is a XFADocument, (https://www.syncfusion.com/forums/130671/fill-pdf-and-flatten-option) that does return a count greater then 0. But when I open up the form in adobe after downloading it all the fields are blank. And even if it is a XFA document I can't figure out how to flatten it so it will be viewable like normal pdfs in a browser (and ofcourse without clearing the data in the form).
Additional details :
Using nuget Syncfusion.Pdf.Net.Core library
This is a web application so I'm getting the portfolio pdf as an IForm file input (and I am converting the split pdf's back into a memory stream --> to an array of IForm file's to pass to another class).
I should add I tried the Syncfusion.Pdf.AspNet package as well to try this bit of code
//Load the existing document
PdfLoadedXfaDocument ldoc = new PdfLoadedXfaDocument("input.pdf");
ldoc.Flatten = true;
//Save the document
//Close the document
BUT... I get the following error
An unhandled exception has occurred while executing the request.
System.TypeInitializationException: The type initializer for 'Syncfusion.Pdf.Graphics.PdfTrueTypeFont' threw an exception. ---> System.NotSupportedException: No data is available for encoding 1252. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.