We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Need to make a fillable pdf form web-viewable

Hi,

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");

//Set flatten

ldoc.Flatten = true;

//Save the document

ldoc.Save("output.pdf");

//Close the document

ldoc.Close();

BUT... I get the following error
Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1]
      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.

3 Replies

GK Gowthamraj Kumar Syncfusion Team January 15, 2020 01:07 PM UTC

Hi Amy, 

Thank you for using Syncfusion product. 

We have tried to reproduce the reported issue in our end. We suspect that the issue may occurs with the specific document. So, kindly share us the input document, complete code snippet, simple sample to reproduce the issue in our end. So that it will be helpful for us to analyze and assist you further on this. 

Regards, 
Gowthamraj K 



AH Amy H January 16, 2020 05:33 PM UTC

Is there a help email I can send the document to? I don't want to post it on an open forum?



DJ Davis Jebaraj Syncfusion Team January 16, 2020 10:18 PM UTC

Hi Amy,
Please email the document support at syncfusion.com

Thanks,

Davis

Loader.
Live Chat Icon For mobile
Up arrow icon