From c649688eac0265c45ca0a0fd7ad5d90ee4311eac Mon Sep 17 00:00:00 2001 From: arved Date: Fri, 10 Mar 2000 03:25:46 +0000 Subject: [PATCH] Added support for links git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193296 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/fop/render/pdf/PDFRenderer.java | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/org/apache/fop/render/pdf/PDFRenderer.java b/src/org/apache/fop/render/pdf/PDFRenderer.java index a2af3330f..b97b7d776 100644 --- a/src/org/apache/fop/render/pdf/PDFRenderer.java +++ b/src/org/apache/fop/render/pdf/PDFRenderer.java @@ -82,6 +82,12 @@ public class PDFRenderer implements Renderer { /** the current stream to add PDF commands to */ PDFStream currentStream; + /** the current annotation list to add annotations to */ + PDFAnnotList currentAnnotList; + + /** the current page to add annotations to */ + PDFPage currentPage; + /** the current (internal) font name */ protected String currentFontName; @@ -505,11 +511,15 @@ public class PDFRenderer implements Renderer { currentStream.add("ET\n"); - this.pdfDoc.makePage(this.pdfResources, currentStream, + currentPage = this.pdfDoc.makePage(this.pdfResources, currentStream, page.getWidth()/1000, page.getHeight()/1000); - /*if (page.hasLinks()) { + if (page.hasLinks()) { + + currentAnnotList = this.pdfDoc.makeAnnotList(); + currentPage.setAnnotList(currentAnnotList); + Enumeration e = page.getLinkSets().elements(); while (e.hasMoreElements()) { LinkSet linkSet = (LinkSet) e.nextElement(); @@ -517,10 +527,13 @@ public class PDFRenderer implements Renderer { Enumeration f = linkSet.getRects().elements(); while (f.hasMoreElements()) { Rectangle rect = (Rectangle) f.nextElement(); - this.pdfDoc.makeLink(rect, dest); + currentAnnotList.addLink(this.pdfDoc.makeLink(rect, dest)); } } - } */ + } else { + // just to be on the safe side + currentAnnotList = null; + } } /** -- 2.39.5