Greetings,

I just got iText in Action and am starting to dig into this great tool. I am 
using iText in a JSP scriptlet.

I want to create a HTTP service that can create PDFs from simpler content such 
as  JSON. So remote services could generate PDF with similar but varying 
layouts, without having to re-write the JSP for every small variation in the 
related services. e.g. think of a report with different fields and section 
names, for instance.

There could be a JSON representation of the different iText Elements, something 
like below, and then in Java unmarshall the JSON text into iText Document and 
adding the Elements to it.

I have looked at some of the Java object marshalling libraries that are 
available, and they looked pretty much like overkill for something like this 
and 
most of them are focused on XML not JSON.

So I thought I would ask- has anyone tried to create PDFs from JSON using 
iText? 
Any suggestions for either a) what design pattern in Java to use, or b) a 
dynamic scripting language running in Java to make an iText element factory?

Hopefully this question makes sense, if not please let me know!


// JSON representing iText Elements

{
     "iText" :
     [
        {"class" : "Paragraph",
          "constructor" : "Paragraph from a string with no formatting. Nullam 
commodo bibendum est. Vestibulum congue. Donec luctus velit at erat. "},
        {"class": "Paragraph",
           "add" :
           [
             { "class": "Chunk",
                 "constructor" : "Paragraph composed of Chunks and Phrases."},
        
             { "class": "Phrase" ,
                "constructor" : "Styled text: Etiam diam est, fermentum id, 
lacinia nec, auctor vel, justo. Curabitur vestibulum tempor turpis. Nunc vitae 
mi. Etiam eget magna. Etiam blandit porta justo.",
                "font", "font ...",
                "color", "color... etc."}
         ]
        }
     ]
}


-- 
Alex Rice <[EMAIL PROTECTED]>
Santa Fe Institute / Internet Application Developer
505-946-2716 desk
505-603-5639 cell
http://www.santafe.edu

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
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

Reply via email to