From 0b78ccfe90b93c0b5c529107d44341a794039b78 Mon Sep 17 00:00:00 2001 From: Keiron Liddle Date: Tue, 14 Jan 2003 19:55:20 +0000 Subject: [PATCH] setting for page mode, fixed some errors git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@195856 13f79535-47bb-0310-9956-ffa450edef68 --- src/org/apache/fop/pdf/PDFOutline.java | 4 +-- src/org/apache/fop/pdf/PDFRoot.java | 50 ++++++++++++++++++++++---- 2 files changed, 45 insertions(+), 9 deletions(-) diff --git a/src/org/apache/fop/pdf/PDFOutline.java b/src/org/apache/fop/pdf/PDFOutline.java index ef5a099d9..76c4990b9 100644 --- a/src/org/apache/fop/pdf/PDFOutline.java +++ b/src/org/apache/fop/pdf/PDFOutline.java @@ -52,7 +52,7 @@ public class PDFOutline extends PDFObject { * @param title the title of the outline entry (can only be null for root Outlines obj) * @param action the action for this outline */ - public PDFOutline(int number, String title, String action) { + public PDFOutline(int number, String ti, String action) { super(number); subentries = new ArrayList(); count = 0; @@ -61,7 +61,7 @@ public class PDFOutline extends PDFObject { next = null; first = null; last = null; - title = title; + title = ti; actionRef = action; } diff --git a/src/org/apache/fop/pdf/PDFRoot.java b/src/org/apache/fop/pdf/PDFRoot.java index ea112f8ad..5445cc4b2 100644 --- a/src/org/apache/fop/pdf/PDFRoot.java +++ b/src/org/apache/fop/pdf/PDFRoot.java @@ -12,6 +12,26 @@ package org.apache.fop.pdf; */ public class PDFRoot extends PDFObject { + /** + * Use no page mode setting, default + */ + public static final int PAGEMODE_USENONE = 0; + + /** + * Use outlines page mode to show bookmarks + */ + public static final int PAGEMODE_USEOUTLINES = 1; + + /** + * Use thumbs page mode to show thumbnail images + */ + public static final int PAGEMODE_USETHUMBS = 2; + + /** + * Full screen page mode + */ + public static final int PAGEMODE_FULLSCREEN = 3; + /** * the /Pages object that is root of the Pages hierarchy */ @@ -22,6 +42,8 @@ public class PDFRoot extends PDFObject { */ private PDFOutline outline; + private int pageMode = PAGEMODE_USENONE; + /** * create a Root (/Catalog) object. NOTE: The PDFRoot * object must be created before the PDF document is @@ -38,13 +60,13 @@ public class PDFRoot extends PDFObject { } /** - * Before the root is written to the document stream, - * make sure it's object number is set. Package-private access - * only; outsiders should not be fiddling with this stuff. + * Set the page mode for the PDF document. + * + * @param mode the page mode */ - /*void setNumber(int number) { - this.number = number; - }*/ + public void setPageMode(int mode) { + pageMode = mode; + } /** * add a /Page object to the root /Pages object @@ -95,8 +117,22 @@ public class PDFRoot extends PDFObject { if (outline != null) { p.append(" /Outlines " + outline.referencePDF() + "\n"); p.append(" /PageMode /UseOutlines\n"); + } else { + switch (pageMode) { + case PAGEMODE_USEOUTLINES: + p.append(" /PageMode /UseOutlines\n"); + break; + case PAGEMODE_USETHUMBS: + p.append(" /PageMode /UseThumbs\n"); + break; + case PAGEMODE_FULLSCREEN: + p.append(" /PageMode /FullScreen\n"); + break; + case PAGEMODE_USENONE: + default: + break; + } } - p.append(" /PageMode /FullScreen\n"); p.append(" >>\nendobj\n"); return p.toString().getBytes(); } -- 2.39.5