1 //========================================================================
5 // Copyright 1996-2003 Glyph & Cog, LLC
7 //========================================================================
14 #ifdef USE_GCC_PRAGMAS
31 //------------------------------------------------------------------------
33 //------------------------------------------------------------------------
38 PDFDoc(GString *fileNameA, GString *ownerPassword = NULL,
39 GString *userPassword = NULL, void *guiDataA = NULL);
41 PDFDoc(wchar_t *fileNameA, int fileNameLen, GString *ownerPassword = NULL,
42 GString *userPassword = NULL, void *guiDataA = NULL);
44 PDFDoc(BaseStream *strA, GString *ownerPassword = NULL,
45 GString *userPassword = NULL, void *guiDataA = NULL);
48 // Was PDF document successfully opened?
49 GBool isOk() { return ok; }
51 // Get the error code (if isOk() returns false).
52 int getErrorCode() { return errCode; }
55 GString *getFileName() { return fileName; }
57 // Get the xref table.
58 XRef *getXRef() { return xref; }
61 Catalog *getCatalog() { return catalog; }
64 BaseStream *getBaseStream() { return str; }
66 // Get page parameters.
67 double getPageMediaWidth(int page)
68 { return catalog->getPage(page)->getMediaWidth(); }
69 double getPageMediaHeight(int page)
70 { return catalog->getPage(page)->getMediaHeight(); }
71 double getPageCropWidth(int page)
72 { return catalog->getPage(page)->getCropWidth(); }
73 double getPageCropHeight(int page)
74 { return catalog->getPage(page)->getCropHeight(); }
75 int getPageRotate(int page)
76 { return catalog->getPage(page)->getRotate(); }
78 // Get number of pages.
79 int getNumPages() { return catalog->getNumPages(); }
81 // Return the contents of the metadata stream, or NULL if there is
83 GString *readMetadata() { return catalog->readMetadata(); }
85 // Return the structure tree root object.
86 Object *getStructTreeRoot() { return catalog->getStructTreeRoot(); }
89 void displayPage(OutputDev *out, int page, double hDPI, double vDPI,
90 int rotate, GBool useMediaBox, GBool crop,
92 GBool (*abortCheckCbk)(void *data) = NULL,
93 void *abortCheckCbkData = NULL);
95 // Display a range of pages.
96 void displayPages(OutputDev *out, int firstPage, int lastPage,
97 double hDPI, double vDPI, int rotate,
98 GBool useMediaBox, GBool crop, GBool doLinks,
99 GBool (*abortCheckCbk)(void *data) = NULL,
100 void *abortCheckCbkData = NULL);
102 // Display part of a page.
103 void displayPageSlice(OutputDev *out, int page,
104 double hDPI, double vDPI, int rotate,
105 GBool useMediaBox, GBool crop, GBool doLinks,
106 int sliceX, int sliceY, int sliceW, int sliceH,
107 GBool (*abortCheckCbk)(void *data) = NULL,
108 void *abortCheckCbkData = NULL);
110 // Find a page, given its object ID. Returns page number, or 0 if
112 int findPage(int num, int gen) { return catalog->findPage(num, gen); }
114 // Returns the links for the current page, transferring ownership to
118 // Find a named destination. Returns the link destination, or
119 // NULL if <name> is not a destination.
120 LinkDest *findDest(GString *name)
121 { return catalog->findDest(name); }
123 #ifndef DISABLE_OUTLINE
124 // Return the outline object.
125 Outline *getOutline() { return outline; }
128 // Is the file encrypted?
129 GBool isEncrypted() { return xref->isEncrypted(); }
131 // Check various permissions.
132 GBool okToPrint(GBool ignoreOwnerPW = gFalse)
133 { return xref->okToPrint(ignoreOwnerPW); }
134 GBool okToChange(GBool ignoreOwnerPW = gFalse)
135 { return xref->okToChange(ignoreOwnerPW); }
136 GBool okToCopy(GBool ignoreOwnerPW = gFalse)
137 { return xref->okToCopy(ignoreOwnerPW); }
138 GBool okToAddNotes(GBool ignoreOwnerPW = gFalse)
139 { return xref->okToAddNotes(ignoreOwnerPW); }
141 // Is this document linearized?
142 GBool isLinearized();
144 // Return the document's Info dictionary (if any).
145 Object *getDocInfo(Object *obj) { return xref->getDocInfo(obj); }
146 Object *getDocInfoNF(Object *obj) { return xref->getDocInfoNF(obj); }
148 // Return the PDF version specified by the file.
149 double getPDFVersion() { return pdfVersion; }
151 // Save this file with another name.
152 GBool saveAs(GString *name);
154 // Return a pointer to the GUI (XPDFCore or WinPDFCore object).
155 void *getGUIData() { return guiData; }
160 GBool setup(GString *ownerPassword, GString *userPassword);
162 GBool checkEncryption(GString *ownerPassword, GString *userPassword);
163 void getLinks(Page *page);
173 #ifndef DISABLE_OUTLINE