It's clear now. You could use
AcroFields.setFieldProperty() if I had remembered to support the background and
border color. As it is you can only change the text color. Support for the
border and background color will be available by the end of the
month.
Best Regards,
Paulo Soares
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Monday, October 18, 2004 3:33 PM
To: Paulo Soares
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Antwort: RE: [iText-questions] Adding Content to Template
Ok. Will try to make it clear:
I have a PDF Template called "ts_int.pdf". This is a PDF Document with 31 rows and
13 columns. This PDF is made with Adobe Indesign. Then i have created in Adobe
Acrobat 5.0 Form fields wich are declared as "Text" without any definit format. They
are named like "F_1_1" for the first field (in the first Cell at the first Row) and "F_13_31"
(for the last Cell in the 13th row).
Then i wrote a Java Agent in Lotus Domino that fills the PDF Fields with Data from Domino.
------------------ 8< ---- SNIP -------
import com.lowagie.text.*;
import com.lowagie.text.pdf.PdfWriter;
import com.lowagie.text.pdf.*;
[..]
PdfReader reader = new PdfReader("/local/notesdata/webcontent/tpl_ts_int.pdf");
PdfStamper stamp = new PdfStamper(reader, new FileOutputStream("/tmp/myPDF.pdf"));
AcroFields form = stamp.getAcroFields();
[..]
// AT THE BOTTOM OF THE DOC SET THE FIELDS (DATA IS READ OUT OF DOMINO
form.setField("Year", DB_Year);
form.setField("Month", DB_Month);
form.setField("HoursADay", DB_HoursPerDay);
form.setField("PersNo", DB_CustomerNo);
form.setField("CostCentre", DB_CostCentre);
Paragraph = DB_FirstName + ", " + DB_LastName;
form.setField("Name", Paragraph);
[..]
// FOR EVERY DAY READ THE HOURS AND THE ORDER-NO OUT OF THE DATABASE
// AND SET THE FIELD IN PDF THAT BELONGS TO THE DAY AND THE ORDERNO
// "Field" IS THE CALCULATED FIELDNAME IN PDF CALCULATED OF THE "Day in Month"
// (1-31) AND THE ROW (1-14). SO I CAN CALCULATE THE FIELDNAME (e.g. "F_14_2")
[..]
form.setField(Field , Hours);
[..]
// FLATTEN ALL FIELDS IN PDF
stamp.setFormFlattening(true);
stamp.close();
// SAFE THE NEW PDF
PrintWriter output = this.getAgentOutput();
---------------- >8--------- SNAP ----------------------
Thats how i create the PDF Document. And within my Java Agent i calculate the Weekend-Days.
Now i need to either set the background for the rows representing weekends to grey, or add a
table to the PDF over the positions of the rows representing the weekend-days.
I hope i made my situation clear :-) It's not so easy if you work on a projekt for weeks ...
Mit freundlichen Gruessen / Kind Regards
Jens Dinstühler
[EMAIL PROTECTED] schrieb am 18.10.2004 13:36:50:
> Define template and field (PdfTemplate, another pdf, form fields, etc).
>
> Best Regards,
> Paulo Soares
>
> From: [EMAIL PROTECTED] [mailto:itext-
> [EMAIL PROTECTED] On Behalf Of Jens.
> [EMAIL PROTECTED]
> Sent: Monday, October 18, 2004 12:16 PM
> To: [EMAIL PROTECTED]
> Subject: [iText-questions] Adding Content to Template
>
> Hello,
>
> we are using iText for creating PDF Documents filled with
> Data out of an Lotus Domino Server System. I've created
> an Agent to realise that.
>
> Now i have a Template with many Fields that have to be filled
> and everything seems to work fine, but now i have a problem
> i can't find a solution by myself.
>
> The PDF Template has 31 rows and 13 colums. In every "cell"
> is a field that will be filled by iText. Some rows of this Table
> have to be "grayed in". Each row represents a day of month
> and the Weekends have to have a gray Background.
>
> I thought about adding a table with only one cell to the Template
> for every weekend and puttin it over the Content of the Template.
>
> I found no way to add a table to a Template. I tried to use the
> "getWriter" method of the PDFStamper but this won't work here.
>
> Can anybody give me a hint how to add a table to a Template
> with Fields?
>
> Kind Regards
