I want to create XML from template.pdf, filling it's elements with data from xml.
So, what we have:
- template.pdf - this file was created using Adobe Livecycle Designer and contains data binding <PDF elemet> <-> <XSD elemet>
- data.xsd - the XSD that was is binded to template.pdf
- data.xml - XML data file conforming data.xsd
And what we want:
create template_instance.pdf based on the template.pdf filled with data from data.xml
In other words I want iText do something like this:
new PdfDocument(template.pdf, data.xsd, data.xml)
For now, I manually set fields in PDF throgh setField() with data from XML (XML is accessed using XMLBeans).
iText has no provisions for adding text to a PDF after it's been created, unless you're talking about filling in form fields (but it doesn't sound like you are).
In general, the things you can do with a PDF after it's been created are rather limited. You may be better off with creating RTF templates, and then performing a text search-and-replace in that. You could use a library like PODConverter to create a PDF from the RTF afterwards.
Thanks a lot for answers, I just returned here not long ago and had the wrong e-mail in my profile.
Well, better later then never, I'll just describe the way we've done it.
We just replace root element in XFA form(which holds) data. Assuming the new root element conforms to the XSD used for PDF creation it works fine. Will better post code a bit later to fix the solution.
So, although iText is great, it still can't provide full control over PDF. Some things you can do by manual editing of XFA form xml, but can't with iText.
subject: PDF generation using iText + template + XML + XSD