1 //========================================================================
5 // Copyright 1996-2003 Glyph & Cog, LLC
7 //========================================================================
14 #ifdef USE_GCC_PRAGMAS
33 //------------------------------------------------------------------------
35 //------------------------------------------------------------------------
40 PDFDoc(GString *fileNameA, GString *ownerPassword = NULL,
41 GString *userPassword = NULL);
42 PDFDoc(BaseStream *strA, GString *ownerPassword = NULL,
43 GString *userPassword = NULL);
46 // Was PDF document successfully opened?
47 GBool isOk() { return ok; }
49 // Get the error code (if isOk() returns false).
50 int getErrorCode() { return errCode; }
53 GString *getFileName() { return fileName; }
55 // Get the xref table.
56 XRef *getXRef() { return xref; }
59 Catalog *getCatalog() { return catalog; }
62 BaseStream *getBaseStream() { return str; }
64 // Get page parameters.
65 double getPageWidth(int page)
66 { return catalog->getPage(page)->getWidth(); }
67 double getPageHeight(int page)
68 { return catalog->getPage(page)->getHeight(); }
69 int getPageRotate(int page)
70 { return catalog->getPage(page)->getRotate(); }
72 // Get number of pages.
73 int getNumPages() { return catalog->getNumPages(); }
75 // Return the contents of the metadata stream, or NULL if there is
77 GString *readMetadata() { return catalog->readMetadata(); }
79 // Return the structure tree root object.
80 Object *getStructTreeRoot() { return catalog->getStructTreeRoot(); }
83 void displayPage(OutputDev *out, int page, double hDPI, double vDPI,
84 int rotate, GBool doLinks,
85 GBool (*abortCheckCbk)(void *data) = NULL,
86 void *abortCheckCbkData = NULL,
87 GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = NULL,
88 void *annotDisplayDecideCbkData = NULL);
90 // Display a range of pages.
91 void displayPages(OutputDev *out, int firstPage, int lastPage,
92 double hDPI, double vDPI, int rotate, GBool doLinks,
93 GBool (*abortCheckCbk)(void *data) = NULL,
94 void *abortCheckCbkData = NULL,
95 GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = NULL,
96 void *annotDisplayDecideCbkData = NULL);
98 // Display part of a page.
99 void displayPageSlice(OutputDev *out, int page,
100 double hDPI, double vDPI,
101 int rotate, int sliceX, int sliceY,
102 int sliceW, int sliceH,
103 GBool (*abortCheckCbk)(void *data) = NULL,
104 void *abortCheckCbkData = NULL,
105 GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = NULL,
106 void *annotDisplayDecideCbkData = NULL);
108 // Find a page, given its object ID. Returns page number, or 0 if
110 int findPage(int num, int gen) { return catalog->findPage(num, gen); }
112 // If point <x>,<y> is in a link, return the associated action;
114 LinkAction *findLink(double x, double y)
115 { return links ? links->find(x, y) : (LinkAction *)NULL; }
117 // Return true if <x>,<y> is in a link.
118 GBool onLink(double x, double y) { return links->onLink(x, y); }
120 // Find a named destination. Returns the link destination, or
121 // NULL if <name> is not a destination.
122 LinkDest *findDest(GString *name)
123 { return catalog->findDest(name); }
125 #ifndef DISABLE_OUTLINE
126 // Return the outline object.
127 Outline *getOutline() { return outline; }
130 // Is the file encrypted?
131 GBool isEncrypted() { return xref->isEncrypted(); }
133 // Check various permissions.
134 GBool okToPrint(GBool ignoreOwnerPW = gFalse)
135 { return xref->okToPrint(ignoreOwnerPW); }
136 GBool okToChange(GBool ignoreOwnerPW = gFalse)
137 { return xref->okToChange(ignoreOwnerPW); }
138 GBool okToCopy(GBool ignoreOwnerPW = gFalse)
139 { return xref->okToCopy(ignoreOwnerPW); }
140 GBool okToAddNotes(GBool ignoreOwnerPW = gFalse)
141 { return xref->okToAddNotes(ignoreOwnerPW); }
143 // Is this document linearized?
144 GBool isLinearized();
146 // Return the document's Info dictionary (if any).
147 Object *getDocInfo(Object *obj) { return xref->getDocInfo(obj); }
148 Object *getDocInfoNF(Object *obj) { return xref->getDocInfoNF(obj); }
150 // Return the PDF version specified by the file.
151 double getPDFVersion() { return pdfVersion; }
153 // Save this file with another name.
154 GBool saveAs(GString *name);
158 GBool setup(GString *ownerPassword, GString *userPassword);
160 void getLinks(Page *page);
169 #ifndef DISABLE_OUTLINE