]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
setting for page mode, fixed some errors
authorKeiron Liddle <keiron@apache.org>
Tue, 14 Jan 2003 19:55:20 +0000 (19:55 +0000)
committerKeiron Liddle <keiron@apache.org>
Tue, 14 Jan 2003 19:55:20 +0000 (19:55 +0000)
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
src/org/apache/fop/pdf/PDFRoot.java

index ef5a099d943062904d0ab64acda50474ae129adb..76c4990b9485ebc0be6f851d40e40c6cc1bf7b54 100644 (file)
@@ -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;
     }
 
index ea112f8adaef9576ad9e07973539d2f72785dd7a..5445cc4b28a8002abef007ba6626969b921a1e10 100644 (file)
@@ -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();
     }