diff --git a/java/src/main/java/com/genexus/reports/PDFReportPDFBox.java b/java/src/main/java/com/genexus/reports/PDFReportPDFBox.java index 3572aa740..c328555c5 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; } } @@ -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();