• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

PDF generation using iText + template + XML + XSD

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?

 
Marshal
Posts: 28226
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic