Thanks for the examples, I added some text fields in my Word document using
Open Office, populated them using iText and flattened the document, it works
well. Working on fields with OO seems a bit sketchy, but at least I have a
proof of concept for that part.

I am struggling now with a PDF chart that I generated previously in a
separate document using iText. I need now to integrate it in my template, so
I created a big button, like in the example for the photos. But where do I
get the PdfTemplate object from here?

    PdfReader reader = new PdfReader(filename);
    PdfStamper stamper = new PdfStamper(reader, out);

    AcroFields form = stamper.getAcroFields();
    HashMap<String,AcroFields.Item> fields = form.getFields();
    System.out.println("Fields: " + fields);
    Set<String> fieldnames = fields.keySet();
    System.out.println("Field names: " + fieldnames);

    form.setField("name", "Dave Matthews");
    form.setField("school", "DMB");
    form.setField("year", "2020");
    form.setField("classname", "Music Class");
    form.setField("classnumber", "101");
    form.setField("students", "4");

    PdfTemplate wagonwheelcharttemplate = new PdfTemplate(); *// no such
constructor, where do I get the PdfTemplate from?*
    wagonwheelcharttemplate.showText("Wagon wheel chart"); // Just testing

    PushbuttonField bt = form.getNewPushbuttonFromField("wagonwheelchart");
    bt.setLayout(PushbuttonField.LAYOUT_ICON_ONLY);
    bt.setProportionalIcon(false);
    bt.setTemplate(wagonwheelcharttemplate);
    form.replacePushbuttonField("wagonwheelchart", bt.getField());

    stamper.setFormFlattening(true);
    stamper.close();
--------------------------------------------------

I noticed that some links need to be fixed in the page

http://1t3xt.info/examples/browse/?page=example&id=332

A few links to the java code are missing the '.java' extension, like in this
one:

"You will also need the helper class
AbstractAccreditation.java<http://1t3xt.info/examples/src/classroom/filmfestival_c/AbstractAccreditation>
:"

The examples also use the (probably) old package names com.lowagie, not
com.itextpdf

Thanks

Fred

On Mon, Feb 15, 2010 at 17:11, 1T3XT info <i...@1t3xt.info> wrote:

> Fred Janon wrote:
> > The charts have fixed dimensions, but probably different size (in
> > bytes)
>
> Sorry, I wasn't clear.
> When I talked about size, I meant dimensions, not byte size.
> The idea is to put a placeholder in the PDF. I usually work
> with a button of which I replace the icon and then flatten
> the document.
>
> See for instance:
> http://1t3xt.info/examples/results/classroom/filmfestival/movies22.pdf
> is the template used to create:
> http://1t3xt.info/examples/results/classroom/filmfestival/movies22.pdf
> or its "flattened" version:
> http://1t3xt.info/examples/results/classroom/filmfestival/movies23_2.pdf
>
> Source code available here:
> http://1t3xt.info/examples/browse/?page=example&id=332
>
> > since the legend will change a bit from one chart to another. I
> > can fix the max length of the strings to replace, meaning I can put a
> > dummy string in the template of the max length, then I can pad the
> > strings when replacing them if necessary.
>
> Working with a dummy string isn't done in PDF.
> You'd better work with text fields for Strings.
> See the example mentioned above.
>
> > Would that work? How can I find the location of the strings to replace
> > in the template? Do I need a template that's a pdf form?
>
> Yes, you need a template that is a PDF form.
> You can create such a template with Open Office.
>
> This form was made by
> http://1t3xt.info/examples/resources/classroom/filmfestival/datasheet.pdf
> It's filled using this code:
> http://1t3xt.info/examples/browse/?page=example&id=330
> --
> This answer is provided by 1T3XT BVBA
> http://www.1t3xt.com/ - http://www.1t3xt.info
>
>
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> 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/
>
------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
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