From 0aa61dd4ebbb5f71c2a1ddfd3d90258b3c489d88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Sexenian?= <99925035+tomas-sexenian@users.noreply.github.com> Date: Tue, 11 Mar 2025 10:47:54 -0300 Subject: [PATCH 1/2] Add missing font name Issue:203719 --- java/src/main/java/com/genexus/reports/PDFReportPDFBox.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/src/main/java/com/genexus/reports/PDFReportPDFBox.java b/java/src/main/java/com/genexus/reports/PDFReportPDFBox.java index 3572aa740..99de4c757 100644 --- a/java/src/main/java/com/genexus/reports/PDFReportPDFBox.java +++ b/java/src/main/java/com/genexus/reports/PDFReportPDFBox.java @@ -482,9 +482,9 @@ public void GxAttris(String fontName, int fontSize, boolean fontBold, boolean fo } } baseFont = createPDType1FontFromName(fontName); + baseFontName = fontName; if (baseFont == null){ baseFont = getOrLoadFont(fontName, document); - baseFontName = fontName; } } From c64e308ae30c469450e56324e3d36270641f8867 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Sexenian?= <99925035+tomas-sexenian@users.noreply.github.com> Date: Tue, 11 Mar 2025 14:14:15 -0300 Subject: [PATCH 2/2] Fix HTML positioning --- .../java/com/genexus/reports/PDFReportPDFBox.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/java/src/main/java/com/genexus/reports/PDFReportPDFBox.java b/java/src/main/java/com/genexus/reports/PDFReportPDFBox.java index 99de4c757..c328555c5 100644 --- a/java/src/main/java/com/genexus/reports/PDFReportPDFBox.java +++ b/java/src/main/java/com/genexus/reports/PDFReportPDFBox.java @@ -652,11 +652,14 @@ public void GxDrawText(String sTxt, int left, int top, int right, int bottom, in log.debug("WARNING: HTML rendering is not natively supported by PDFBOX 2.0.27. Handcrafted support is provided but it is not intended to cover all possible use cases"); try { + float htmlBottomAux = (float)convertScale(bottom); + float htmlTopAux = (float)convertScale(top); + float drawingPageHeight = this.pageSize.getUpperRightY() - topMargin - bottomMargin; float llx = leftAux + leftMargin; - float lly = drawingPageHeight - bottomAux; + float lly = drawingPageHeight - htmlBottomAux; float urx = rightAux + leftMargin; - float ury = drawingPageHeight - topAux; + float ury = drawingPageHeight - htmlTopAux; PDRectangle htmlRectangle = new PDRectangle(llx, lly, urx - llx, ury - lly); SpaceHandler spaceHandler = new SpaceHandler(htmlRectangle.getUpperRightY(), htmlRectangle.getHeight()); @@ -668,13 +671,13 @@ public void GxDrawText(String sTxt, int left, int top, int right, int bottom, in for (Element element : allElements) { if (pageHeightExceeded(bottomMargin, spaceHandler.getCurrentYPosition())) { llx = leftAux + leftMargin; - lly = drawingPageHeight - bottomAux; + lly = drawingPageHeight - htmlBottomAux; urx = rightAux + leftMargin; - ury = drawingPageHeight - topAux; + ury = drawingPageHeight - htmlTopAux; htmlRectangle = new PDRectangle(llx, lly, urx - llx, ury - lly); spaceHandler = new SpaceHandler(htmlRectangle.getUpperRightY(), htmlRectangle.getHeight()); - bottomAux -= drawingPageHeight; + htmlBottomAux -= drawingPageHeight; GxEndPage(); GxStartPage();