View
660
Download
1
Embed Size (px)
DESCRIPTION
Talk by Bruno Lowagie at the iText Summit in2012
Citation preview
The XML Forms Architecture
Bruno Lowagie
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”
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”
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?
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
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,...
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.
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!
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
PARSING XML WITH ITEXT Live Demo
COMBINING XML WORKER WITH ACROFORM TECHNOLOGY
Live Demo
Creating an XFA form
Importing an XSD
Reorganizing the fields
An empty form
A filled out form
FILLING OUT XFA FORMS Live Demo
Try it yourself!
Useful links: http://demo.itextsupport.com/
xfademo/
http://www.youtube.com/
watch?v=qxtAy2Czsh0