1 50 51 package com.lowagie.text.pdf; 52 import java.util.HashMap ; 53 63 64 public class PdfPage extends PdfDictionary { 65 66 private static final String boxStrings[] = {"crop", "trim", "art", "bleed"}; 67 private static final PdfName boxNames[] = {PdfName.CROPBOX, PdfName.TRIMBOX, PdfName.ARTBOX, PdfName.BLEEDBOX}; 68 70 71 public static final PdfNumber PORTRAIT = new PdfNumber(0); 72 73 74 public static final PdfNumber LANDSCAPE = new PdfNumber(90); 75 76 77 public static final PdfNumber INVERTEDPORTRAIT = new PdfNumber(180); 78 79 80 public static final PdfNumber SEASCAPE = new PdfNumber(270); 81 82 83 PdfRectangle mediaBox; 84 85 87 94 95 107 114 115 PdfPage(PdfRectangle mediaBox, HashMap boxSize, PdfDictionary resources, int rotate) { 116 super(PAGE); 117 this.mediaBox = mediaBox; 118 put(PdfName.MEDIABOX, mediaBox); 119 put(PdfName.RESOURCES, resources); 120 if (rotate != 0) { 121 put(PdfName.ROTATE, new PdfNumber(rotate)); 122 } 123 for (int k = 0; k < boxStrings.length; ++k) { 124 PdfObject rect = (PdfObject)boxSize.get(boxStrings[k]); 125 if (rect != null) 126 put(boxNames[k], rect); 127 } 128 } 129 130 136 137 141 147 148 PdfPage(PdfRectangle mediaBox, HashMap boxSize, PdfDictionary resources) { 149 this(mediaBox, boxSize, resources, 0); 150 } 151 152 159 160 public boolean isParent() { 161 return false; 162 } 163 164 166 171 172 void add(PdfIndirectReference contents) { 173 put(PdfName.CONTENTS, contents); 174 } 175 176 181 182 PdfRectangle rotateMediaBox() { 183 this.mediaBox = mediaBox.rotate(); 184 put(PdfName.MEDIABOX, this.mediaBox); 185 return this.mediaBox; 186 } 187 188 193 194 PdfRectangle getMediaBox() { 195 return mediaBox; 196 } 197 } | Popular Tags |