View PDFs with forms in Firefox

SpyrosR :

I am working on a web application and there is a need to preview PDF in Firefox.

Obviously I have embedded the PDF in the HTML code. The problem is that these PDFs contain forms and I know that the built-in Firefox viewer cannot display forms. Except the forms (which contain digital signatures) the rest of the document is displayed properly and in Chrome everything works fine (displaying the signatures too).

I want to ask which is the best approach to support the view of the whole document in Firefox. The current version I am working on is 52.7.3 but I want to do the system scalable for future versions.

I was thinking of transforming the PDF into a Base64 String and embed like that but trying this with some online demos did not work either (maybe the document is quite big?).

The other posibility I was thinking of, is transforming the PDF in JPEG (or similar format) and preview like that. What do you think about that?

Is there any library to handle PDF files from Java/Javascript code that does not use embedded viewers? I tried PDF.js but I realised that it is using the built in viewers. Correct me on this If I am wrong.

Ryan :

You could do something that is called "flattening". This involves taking the form field appearance (graphics) and moving them directly into the page, and then removing the form fields themselves. Is also often done on annotations too.

This ensures that the fields are visible (rendered) by every PDF reader, but also that users cannot possibly edit the fields (since the field is removed).

This would of course invalidate any e-signature, since you are modifying the PDF, but if you kept the original PDF, that should not be an issue.

Once the fields are flattened, then Firefox/Pdf.js will show everything fine.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325834&siteId=1