Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions java/src/main/java/com/genexus/reports/PDFReportPDFBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class PDFReportPDFBox extends GXReportPDFCommons{
private String barcodeType = null;
private PDDocument document;
private PDDocumentCatalog writer;
private PDType0Font templateFont;
private PDFont templateFont;
private float templateX;
private float templateY;
public boolean lineCapProjectingSquare = true;
Expand Down Expand Up @@ -854,14 +854,14 @@ else if (barcodeType != null) {
// Handle {{Pages}}
if (sTxt.trim().equalsIgnoreCase("{{Pages}}")) {
if (!templateCreated) {
templateFont = new PDType0Font(baseFont.getCOSObject());
templateFont = baseFont;
templateFontSize = fontSize;
templateColorFill = foreColor;
templateX = leftAux + leftMargin;
templateY = this.pageSize.getUpperRightY() - bottomAux - topMargin - bottomMargin;
templateCreated = true;
}
return;
sTxt = String.valueOf(this.page);
}

float textBlockWidth = rightAux - leftAux;
Expand Down Expand Up @@ -1271,20 +1271,6 @@ public void GxEndDocument() {
document.addPage(new PDPage(this.pageSize));
pages++;
}
if (templateCreated) {
for (PDPage page : document.getPages()){
try (PDPageContentStream templatePainter = new PDPageContentStream(document, page, PDPageContentStream.AppendMode.APPEND,true, true)) {
templatePainter.beginText();
templatePainter.setFont(templateFont, templateFontSize);
templatePainter.setNonStrokingColor(templateColorFill);
templatePainter.newLineAtOffset(templateX, templateY);
templatePainter.showText(String.valueOf(pages));
templatePainter.endText();
} catch (IOException e){
log.error("GxEndDocument: failed to apply template" , e);;
}
}
}
int copies = 1;
try {
copies = Integer.parseInt(printerSettings.getProperty(form, Const.COPIES));
Expand Down
Loading