the xml forms architecture
Post on 21-Oct-2014
661 views
DESCRIPTION
Talk by Bruno Lowagie at the iText Summit in2012TRANSCRIPT
![Page 1: The XML Forms Architecture](https://reader033.vdocuments.site/reader033/viewer/2022051311/54470cddb1af9fe33a8b4770/html5/thumbnails/1.jpg)
The XML Forms Architecture
Bruno Lowagie
![Page 2: The XML Forms Architecture](https://reader033.vdocuments.site/reader033/viewer/2022051311/54470cddb1af9fe33a8b4770/html5/thumbnails/2.jpg)
PDF: the rationale
• Portable: platform independent
• Document: rendered in a reliable way
• Format: page based approach
• Consistent: predictable result
• Fast: no programming language
• Complete and compact
“Creating PDF is a One-Way Process”
![Page 3: The XML Forms Architecture](https://reader033.vdocuments.site/reader033/viewer/2022051311/54470cddb1af9fe33a8b4770/html5/thumbnails/3.jpg)
XML Forms Architecture
• Document defined in XML – Template: appearance of the form
– Datasets: data and data description
– Rendered on-the-fly in the viewer
• The Portable Document Format is used: – as the container of the XML stream
– for the backgrounds of the form
“Data-based dynamical document”
![Page 4: The XML Forms Architecture](https://reader033.vdocuments.site/reader033/viewer/2022051311/54470cddb1af9fe33a8b4770/html5/thumbnails/4.jpg)
PDF versus XFA
Pro
• XML based – You can use your own schema
– Easy to extract/exchange data
• Dynamic document – Data shapes document
– Variable number of pages
• Functionality (vs AcroForm) – More flexibility
– More feature rich
Contra
• XML based – Slow rendering for large docs
– XML manipulation
• Slow adoption by viewers – Adobe Reader
– Preview
• Not many tools available – Adobe LiveCycle
– Merging, splitting,...
– Problem: continuity?
![Page 5: The XML Forms Architecture](https://reader033.vdocuments.site/reader033/viewer/2022051311/54470cddb1af9fe33a8b4770/html5/thumbnails/5.jpg)
Let’s build an XFA2PDF tool
• iText 5+: filling out XFA forms • iText 5.2.1+: making XFA forms Read-Only • XFA Worker: flatten a filled out XFA form • This is a huge work
– Time + $$$ – Specialists needed
• Different approach – Closed source – Customers only – Different subprojects
![Page 6: The XML Forms Architecture](https://reader033.vdocuments.site/reader033/viewer/2022051311/54470cddb1af9fe33a8b4770/html5/thumbnails/6.jpg)
Let’s start with XML
• Extensible Markup Language (XML) is a set of rules for encoding documents in machine-readable form.
• Hundreds of XML-based languages have been developed, including RSS, Atom, SOAP, SVG, XHTML,...
![Page 7: The XML Forms Architecture](https://reader033.vdocuments.site/reader033/viewer/2022051311/54470cddb1af9fe33a8b4770/html5/thumbnails/7.jpg)
Converting XML to PDF
• Either you use XSLT to transform one type of XML to another one that can be parsed to PDF (this is what is done with XSL-FO).
• Or you can program custom parsers for your custom XML.
• Which approach is best depends on the project.
![Page 8: The XML Forms Architecture](https://reader033.vdocuments.site/reader033/viewer/2022051311/54470cddb1af9fe33a8b4770/html5/thumbnails/8.jpg)
iText before XML Worker
• XmlParser with a custom iText DTD. – Why invent a new standard?
• XmlPeer classes for custom tags. – Good idea, but nobody understood how it works
• Writing your own DocumentHandler. – Not for the faint of heart
• Using HTMLWorker. – Organically grown functionality; dito frustration
• These are things of the past!
![Page 9: The XML Forms Architecture](https://reader033.vdocuments.site/reader033/viewer/2022051311/54470cddb1af9fe33a8b4770/html5/thumbnails/9.jpg)
Understanding XML Worker
• Different pipelines
• In the case of XHTML:
• In the case of custom XML:
CSS pipeline
HTML pipeline
PDF pipeline
Custom pipeline
PDF pipeline
![Page 10: The XML Forms Architecture](https://reader033.vdocuments.site/reader033/viewer/2022051311/54470cddb1af9fe33a8b4770/html5/thumbnails/10.jpg)
PARSING XML WITH ITEXT Live Demo
![Page 11: The XML Forms Architecture](https://reader033.vdocuments.site/reader033/viewer/2022051311/54470cddb1af9fe33a8b4770/html5/thumbnails/11.jpg)
COMBINING XML WORKER WITH ACROFORM TECHNOLOGY
Live Demo
![Page 12: The XML Forms Architecture](https://reader033.vdocuments.site/reader033/viewer/2022051311/54470cddb1af9fe33a8b4770/html5/thumbnails/12.jpg)
Creating an XFA form
![Page 13: The XML Forms Architecture](https://reader033.vdocuments.site/reader033/viewer/2022051311/54470cddb1af9fe33a8b4770/html5/thumbnails/13.jpg)
Importing an XSD
![Page 14: The XML Forms Architecture](https://reader033.vdocuments.site/reader033/viewer/2022051311/54470cddb1af9fe33a8b4770/html5/thumbnails/14.jpg)
Reorganizing the fields
![Page 15: The XML Forms Architecture](https://reader033.vdocuments.site/reader033/viewer/2022051311/54470cddb1af9fe33a8b4770/html5/thumbnails/15.jpg)
An empty form
![Page 16: The XML Forms Architecture](https://reader033.vdocuments.site/reader033/viewer/2022051311/54470cddb1af9fe33a8b4770/html5/thumbnails/16.jpg)
A filled out form
![Page 17: The XML Forms Architecture](https://reader033.vdocuments.site/reader033/viewer/2022051311/54470cddb1af9fe33a8b4770/html5/thumbnails/17.jpg)
FILLING OUT XFA FORMS Live Demo
![Page 18: The XML Forms Architecture](https://reader033.vdocuments.site/reader033/viewer/2022051311/54470cddb1af9fe33a8b4770/html5/thumbnails/18.jpg)
Try it yourself!
Useful links: http://demo.itextsupport.com/
xfademo/
http://www.youtube.com/
watch?v=qxtAy2Czsh0