OK I also considered filling out the background form once with all the
repeating elements and doing a partial flatten, then filling in the
elements that change for each page. Would that make any difference or
would it still leave my end result bloated?
I dug around a bit and found a way to extract font info from a form
field but I'm not sure about its efficiency. Any thoughts?
private TextField getFieldFont(AcroFields acroFields, String fieldName)
{
try {
AcroFields.Item item = acroFields.getFieldItem(fieldName);
PdfDictionary merged = item.getMerged(0);
TextField textField = new TextField(null, null, null);
acroFields.decodeGenericDictionary(merged, textField);
return textField;
}
catch (Exception e) {
e.printStackTrace();
}
return null;
}
then one can simply do textfield.getFont(); textfield.getFontSize() etc....
Many Thanks,
Anthony
Le 15/02/2011 09:24, 1T3XT BVBA a écrit :
Op 14/02/2011 23:36, Antony Webster schreef:
OK but in this case in order to keep the same look as the original
font field I'd need to retrieve its font family, weight and size. How
can this be done? I've looked around online without much luck...
In that case, you should stick with your own design, and create the
background in two passes: fill out the form, then use it as a
background, BUT there's an important caveat: if you do it this way,
adding a background as a PdfImportedPage that is slightly different
for every page, your PDF will be bloated. The common part of the
background (the form without the page numbers) will be added as many
times as there are page. Therefore, you may want to use PdfSmartCopy
instead of PdfStamper in your final pass. PdfSmartCopy will detect the
redundant content, and you'll end up with PDFs that have a much
smaller file size.
------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php
------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php