Hi to all,
I want to discuss approach of generating PDF on the fly with all of
you. Please let me know your suggestions.
Requirement of my application is,
1. User should generate PDF on the fly and
2. Administrator should have privileges to change static part of
template without touching the java code.
I am using type of code
1. PdfGenerate.java
2. Tagmap.xml
3. Template.xml
1. PdfGenerate.java contain logic like
// Step 1
Document document = new Document();
// Step 2: Create a writer that listens to the document
PdfWriter writer = PdfWriter.getInstance(document, new
FileOutputStream("Template.pdf"));
// step 3: Parse the document with merge xml
TagMap rptTagMap = new TagMap("Tagmap.xml");
XmlParser.parse(document, "Template.xml", rptTagMap);
2. Tagmap.xml contain following type of tags which map with iText tag
<tag name="phrase" alias="text">
<attribute name="leading" value="13" />
<attribute name="font" value="Times" />
<attribute name="size" value="10.5" />
<attribute name="fontstyle" value="normal" />
</tag>
<tag name="paragraph" alias="para">
<attribute name="align" value="left" />
<attribute name="leading" value="13" />
<attribute name="spacingafter" value="15" />
<attribute name="font" value="Times" />
<attribute name="size" value="10.5" />
<attribute name="fontstyle" value="normal" />
</tag>
3. Template.xml contain
<?xml version="1.0" encoding="UTF-8" ?>
<para>Default will appear like </para>
<para align="right" fontstyle="italic, underline">Right align with
italic and underline </para>
<text fontstyle="bold">this is bold text </text>
<newline/>
==========================
In above code Tempalte.xml looks too much simple due to defining its
mapping in TagMap.xml. Now administrator just require few knowledge
about XML and he/she can easily change static part of data, WITHOUT
CHANGING ANY THING FROM JAVA CODE.
1. What do you think about this approach ?
2. Please let me know your suggestions about it
3. My next plan is to provide user editing PDF content before PDF
generation. Now as I specify above, PDF will generate on the fly in
web application. Since I want to give facility to user to change PDF
content before generation in a browser. I got FCKiText with korean
language support only. Can anyone tell me about any such tips and
tricks which satisfy above requirement ?
4. Can any one suggest me how I can merge dynamic values (which will
come from database with this type of apporach ?
Waiting eagerly.. for reply from all..
Please, give me your feedback.
Thanks in advance
- Kapil Dhakad
ITShastra (I) Pvt. Ltd.
Mumbai, India
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions