PdfTemplate not visible
Hello,
i have a Problem inserting a template in my document. If i add the template and print text in it at a later time, the text will be there but not visible. You can select the text with the mouse and copy it, but you cant see it. I have in total 2 templates on the document. The first template works like expected. Can you help me with that. The following are the Code snippets.
PdfContentByte cb = creator.getPdf().getDirectContent();
PdfAppearance tpl = cb.createAppearance(100, 25);
tpl.setWidth(celle.getWidth());
tpl.setHeight(celle.getHeight());
float x = creator.getDoc().getPageSize().getLeft(creator.getDoc().leftMargin()) + (45 * colnr);
float y = creator.getDoc().getPageSize().getBottom(creator.getDoc().bottomMargin()) + (35 * rownr);
cb.addTemplate(tpl,
x,
y);
System.out.println("Template Inserted: "+x+" "+y);
Next:
template.beginText();
template.setFontAndSize(BaseFont.createFont("Helvetica", BaseFont.WINANSI, false), 12);
template.setColorFill(Color.BLACK);
template.setTextMatrix(0, 0);
template.showText("Bla: "+ (writer.getPageNumber() - 1));
template.endText();
template.sanityCheck();
There was a bug with transparency (https://github.com/LibrePDF/OpenPDF/pull/378), maybe in this case the color is set to transparent? Maybe you can step down to the PdfContentByte.setColorFill and see, if the alpha value is opaque or transparent.
Hello @ModdyLP , our group are interested in this issue, and we will try to fix it. ---- SE_SUSTech, group: Lanrand
Can anybody check, if this still an issue. Maybe it was already fixed in #378 .
If not, pull requests are welcome.