1 //========================================================================
5 // Copyright 1996-2002 Glyph & Cog, LLC
7 //========================================================================
24 //------------------------------------------------------------------------
27 double x1, y1, x2, y2;
30 //------------------------------------------------------------------------
32 //------------------------------------------------------------------------
37 // Construct a new PageAttrs object by merging a dictionary
38 // (of type Pages or Page) into another PageAttrs object. If
39 // <attrs> is NULL, uses defaults.
40 PageAttrs(PageAttrs *attrs, Dict *dict);
46 PDFRectangle *getBox() { return limitToCropBox ? &cropBox : &mediaBox; }
47 PDFRectangle *getMediaBox() { return &mediaBox; }
48 PDFRectangle *getCropBox() { return &cropBox; }
49 GBool isCropped() { return haveCropBox; }
50 PDFRectangle *getBleedBox() { return &bleedBox; }
51 PDFRectangle *getTrimBox() { return &trimBox; }
52 PDFRectangle *getArtBox() { return &artBox; }
53 int getRotate() { return rotate; }
54 GString *getLastModified()
55 { return lastModified.isString()
56 ? lastModified.getString() : (GString *)NULL; }
57 Dict *getBoxColorInfo()
58 { return boxColorInfo.isDict() ? boxColorInfo.getDict() : (Dict *)NULL; }
60 { return group.isDict() ? group.getDict() : (Dict *)NULL; }
62 { return metadata.isStream() ? metadata.getStream() : (Stream *)NULL; }
64 { return pieceInfo.isDict() ? pieceInfo.getDict() : (Dict *)NULL; }
65 Dict *getSeparationInfo()
66 { return separationInfo.isDict()
67 ? separationInfo.getDict() : (Dict *)NULL; }
68 Dict *getResourceDict()
69 { return resources.isDict() ? resources.getDict() : (Dict *)NULL; }
73 GBool readBox(Dict *dict, char *key, PDFRectangle *box);
75 PDFRectangle mediaBox;
79 PDFRectangle bleedBox;
88 Object separationInfo;
92 //------------------------------------------------------------------------
94 //------------------------------------------------------------------------
100 Page(XRef *xrefA, int numA, Dict *pageDict, PageAttrs *attrsA,
101 GBool printCommandsA);
107 GBool isOk() { return ok; }
109 // Get page parameters.
110 PDFRectangle *getBox() { return attrs->getBox(); }
111 PDFRectangle *getMediaBox() { return attrs->getMediaBox(); }
112 PDFRectangle *getCropBox() { return attrs->getCropBox(); }
113 GBool isCropped() { return attrs->isCropped(); }
114 double getWidth() { return attrs->getBox()->x2 - attrs->getBox()->x1; }
115 double getHeight() { return attrs->getBox()->y2 - attrs->getBox()->y1; }
116 PDFRectangle *getBleedBox() { return attrs->getBleedBox(); }
117 PDFRectangle *getTrimBox() { return attrs->getTrimBox(); }
118 PDFRectangle *getArtBox() { return attrs->getArtBox(); }
119 int getRotate() { return attrs->getRotate(); }
120 GString *getLastModified() { return attrs->getLastModified(); }
121 Dict *getBoxColorInfo() { return attrs->getBoxColorInfo(); }
122 Dict *getGroup() { return attrs->getGroup(); }
123 Stream *getMetadata() { return attrs->getMetadata(); }
124 Dict *getPieceInfo() { return attrs->getPieceInfo(); }
125 Dict *getSeparationInfo() { return attrs->getSeparationInfo(); }
127 // Get resource dictionary.
128 Dict *getResourceDict() { return attrs->getResourceDict(); }
130 // Get annotations array.
131 Object *getAnnots(Object *obj) { return annots.fetch(xref, obj); }
134 Object *getContents(Object *obj) { return contents.fetch(xref, obj); }
137 void display(OutputDev *out, double dpi, int rotate,
138 Links *links, Catalog *catalog);
142 XRef *xref; // the xref table for this PDF file
143 int num; // page number
144 PageAttrs *attrs; // page attributes
145 Object annots; // annotations array
146 Object contents; // page contents
147 GBool printCommands; // print the drawing commands (for debugging)
148 GBool ok; // true if page is valid