Hi everyone,So I baked up a little template with InDesign, and am loading the template at generation time with a writer.setPageEvent call that accepts the following object:
****
private final class SomePDFTemplate extends PdfPageEventHelper {
protected PdfImportedPage paper;
protected PdfLayer not_printed;
@Override
public void onOpenDocument(PdfWriter writer, Document document ) {
try{
PdfReader reader = new PdfReader("template.pdf");
paper = writer.getImportedPage(reader, 1);
not_printed = new PdfLayer("template", writer);
not_printed.setOnPanel(false);
not_printed.setPrint("Print", false);
}
catch( Exception x ){
x.printStackTrace();
}
}
public void onStartPage(PdfWriter writer, Document document){
PdfContentByte cb = writer.getDirectContent();
cb.beginLayer(not_printed);
cb.addTemplate(paper, 0, 0);
cb.endLayer();
}
public void onEndPage( PdfWriter writer, Document document ){
try{
}
catch( Exception e ){
throw new ExceptionConverter( e );
}
}
}
****The template is applied, however, the bottom-right graphic that is meant to be in the background in that template, unfortunately appears at the topmost layer in the generated PDF, blocking out any text/graphics "beneath" it (as though it had a Z-order of 3248394230 with divs).
How do I specify that the objects that I add to the document, should be at the very top, and not behind what was previously stamped on the page?
TIA! David
template.pdf
Description: Adobe PDF document
------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
