This question has probably been asked a hundred times, although I don't see
anything in the FAQ.

Is there a package that lets you create PDF from an XML representation of a
document?

What I have in mind is being able to write an XML document, something like
this:

<font id="my-font" font-face="Palatino" />

<style id="my-style" font="my-font" size="12" />

<style id="emphasis" weight="bold" color="red" />

<paragraph style="my-style">This is an  <span
style="emphasis">example</span> paragraph.</paragraph>

... (more paragraphs...)

This XML would then be streamed into a writer (i.e. a java.io.Writer
implementation) which is actually a bridge to iText API calls and would
build the PDF. The fact that it's done as a Writer makes it possible to
generate the XML from a Velocity template and stream it right out to
generate the PDF correctly. I actually did something like this a while ago,
although it used a custom syntax (not XML, and not particularly readable or
easy to maintain).

It struck me that something like this would be useful enough that someone,
somewhere has probably already done it. Does anyone on this list know of
something that will do something like this?

The reason I ask is that I have a Spring MVC web application project which
will require PDF output and at the moment the perceived solution is to
create custom PdfView classes for each document type that's required; I'd
prefer to have one generic view class that can accept an XML document
template and merge it with the model map to create the required PDFs. While
I could create such a thing myself, I'm not about to reinvent something
that already does what I need.

--Pete


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to