Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

PDF generation using iText + template + XML + XSD

 
Anton Lunev
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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).

Is this kind of magic possible with iText ?

 
Paul Clapham
Sheriff
Pie
Posts: 20958
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since this question is explicitly about iText and only tangentially about XML, let's move it to the forum which is about iText.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Redrick Shuhart
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic