From 7cda5ead41cc5605ce48551a8fcd515711050939 Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Thu, 30 Jun 2005 07:56:25 +0000 Subject: [PATCH] Fix placement of links in PDFs. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@202503 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/render/pdf/PDFRenderer.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/java/org/apache/fop/render/pdf/PDFRenderer.java b/src/java/org/apache/fop/render/pdf/PDFRenderer.java index 0d5af5877..5af6df8d8 100644 --- a/src/java/org/apache/fop/render/pdf/PDFRenderer.java +++ b/src/java/org/apache/fop/render/pdf/PDFRenderer.java @@ -158,6 +158,8 @@ public class PDFRenderer extends PrintRenderer { * the current page to add annotations to */ protected PDFPage currentPage; + + protected AffineTransform currentBasicTransform; /** drawing state */ protected PDFState currentState = null; @@ -463,6 +465,8 @@ public class PDFRenderer extends PrintRenderer { // Transform origin at top left to origin at bottom left currentStream.add("1 0 0 -1 0 " + (int) Math.round(pageHeight / 1000) + " cm\n"); + currentBasicTransform = new AffineTransform(1, 0, 0, -1, 0, + (int) Math.round(pageHeight / 1000)); currentFontName = ""; @@ -1290,7 +1294,8 @@ public class PDFRenderer extends PrintRenderer { Rectangle2D rect = new Rectangle2D.Float(start, top, width, height); // transform rect to absolute coords AffineTransform transform = currentState.getTransform(); - rect = transform.createTransformedShape(rect).getBounds(); + rect = transform.createTransformedShape(rect).getBounds2D(); + rect = currentBasicTransform.createTransformedShape(rect).getBounds2D(); int type = internal ? PDFLink.INTERNAL : PDFLink.EXTERNAL; PDFLink pdflink = pdfDoc.getFactory().makeLink( -- 2.39.5