18
The XML Forms Architecture Bruno Lowagie

The XML Forms Architecture

  • View
    660

  • Download
    1

Embed Size (px)

DESCRIPTION

Talk by Bruno Lowagie at the iText Summit in2012

Citation preview

Page 1: The XML Forms Architecture

The XML Forms Architecture

Bruno Lowagie

Page 2: The XML Forms Architecture

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

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

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

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

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

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

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

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

PARSING XML WITH ITEXT Live Demo

Page 11: The XML Forms Architecture

COMBINING XML WORKER WITH ACROFORM TECHNOLOGY

Live Demo

Page 12: The XML Forms Architecture

Creating an XFA form

Page 13: The XML Forms Architecture

Importing an XSD

Page 14: The XML Forms Architecture

Reorganizing the fields

Page 15: The XML Forms Architecture

An empty form

Page 16: The XML Forms Architecture

A filled out form

Page 17: The XML Forms Architecture

FILLING OUT XFA FORMS Live Demo

Page 18: The XML Forms Architecture

Try it yourself!

Useful links: http://demo.itextsupport.com/

xfademo/

http://www.youtube.com/

watch?v=qxtAy2Czsh0