mozilla / pdf.js

PDF Reader in JavaScript
https://mozilla.github.io/pdf.js/
Apache License 2.0
48.63k stars 10k forks source link

Support XML Forms Architecture (XFA) forms #2373

Closed abevoelker closed 3 years ago

abevoelker commented 12 years ago

XFA forms are XML-based forms created by Adobe's LiveCycle Designer tool. They offer enhanced features over the old AcroForms method of creating fillable PDF forms with things like growable text fields (which can overflow across page boundaries) and "Rich Text," which is a subset of XHTML and CSS for stylizing text. There is also support for running JavaScript and FormCalc (a proprietary scripting language) scripts for manipulating data using a "Scripting Object Model" (SOM - looks sort of like XPath). Other features include network interaction with servers (e.g. form submission) using HTTP or WSDL/SOAP. I believe you can also embed regular PDF documents inside XFA.

I don't pretend to understand XFA (the standard is here), but I have had to deal with it recently as it seems to be the direction that Adobe is pushing towards as until very recently (with the latest version of iText), the only reliable way of manipulating these forms were with Adobe's LiveCycle Server product (epic $). And so far, the only renderer that I've used that can even display them is Adobe Acrobat.

I see XFA has been mentioned on the Mozilla wiki and on the mailing list and it looks like there is some trepidation in supporting it as it is still a proprietary standard. If this is still the case, does that mean that pull requests would also not be accepted relating to XFA?

I can totally understand why you would not want to support a proprietary and complicated standard, but thought I would bring it up anyway as it's frustrating being locked into Adobe Reader and LiveCycle Server products. Thanks!

nacengineer commented 12 years ago

+1

brendandahl commented 12 years ago

Since this isn't currently part of the ISO standard there are no plans to implement it. Until it is in the ISO standard, it would probably be best if the support was added in some kind of "extension" to pdf.js in a separate repo.

If someone is serious and wants put the work into adding it into mainstream pdf.js they should ping me and I could look into the implications.

brendensoares commented 9 years ago

I would be interested in working on an extension to support this. It seems pdf2json already has written an extension for pdf.js. Any comments on this?

fbender commented 9 years ago

This should be revisited. Even if XFA is not a de-jure standard, it unfortunately is a de-facto standard (along AcroForms) with great distribution and (medium) renderer support. Since browsers are deprecating NPAPI plugins, it will (for a lot of existing content and content still generated today) no longer be possible to fill out PDFs with forms within the browser, leading to users being annoyed and/or websites force-downloading PDF files to be opened with another PDF reader. Supporting forms in PDF (both XFA and AcroForms) is a unique feature that has the potential to influence the market. Issue #1459 contains further reasoning.

wanghaisheng commented 8 years ago

any update?

timvandermeij commented 8 years ago

Currently we're working on AcroForm support (in #7613). XFA support is not planned, but I think the AcroForms work should definitely help to simplify the implementation for XFA support.

Vinmj commented 6 years ago

Any updates on supporting LiveCycle PDF Documents?

nekohayo commented 3 years ago

In case this might somehow be useful, perhaps you could use PDFium's XFA implementation code as inspiration for an implementation in pdfjs? I have no idea if it actually works, in any case it's probably better than nothing: https://github.com/chromium/pdfium/tree/master/xfa

ludakhris commented 3 years ago

I hate to keep asking about this but has there been any progress on this???

timvandermeij commented 3 years ago

XFA support is being developed and experimental, but is progressing.

ludakhris commented 3 years ago

Thanks so much @timvandermeij is there a timeframe or a pull request that interested parties can follow?

timvandermeij commented 3 years ago

The list of merged PRs is https://github.com/mozilla/pdf.js/pulls?q=is%3Apr+xfa+is%3Aclosed.

marco-c commented 3 years ago

I think we can now close this, as the main XFA-related work has landed.

garyvdm commented 3 years ago

Thanks for all the hard work that went into this!

In what version of Firefox is this expected to land?

marco-c commented 3 years ago

Firefox 91

marco-c commented 3 years ago

You can already test it in Firefox Nightly, by setting the pdfjs.enableXfa preference to true.

garyvdm commented 3 years ago

Got it working. Thanks!

keyhan commented 3 years ago

Is is possible now to save the filled input in separate XFA-file or is it merged into the PDF? Or is it not saved at all like in Acrobat Reader?

marco-c commented 3 years ago

@keyhan the filled data should be saved as part of the PDF.