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 xObject.
86 xObject
*getStructTreeRoot() { return catalog
->getStructTreeRoot(); }
89 void displayPage(OutputDev
*out
, int page
,
90 double hDPI
, double vDPI
, int rotate
,
91 GBool useMediaBox
, GBool crop
, GBool printing
,
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 printing
,
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 printing
,
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 xObject 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
116 Links
*getLinks(int page
);
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 // Process the links for a page.
124 void processLinks(OutputDev
*out
, int page
);
126 #ifndef DISABLE_OUTLINE
127 // Return the outline xObject.
128 Outline
*getOutline() { return outline
; }
131 // Is the file encrypted?
132 GBool
isEncrypted() { return xref
->isEncrypted(); }
134 // Check various permissions.
135 GBool
okToPrint(GBool ignoreOwnerPW
= gFalse
)
136 { return xref
->okToPrint(ignoreOwnerPW
); }
137 GBool
okToChange(GBool ignoreOwnerPW
= gFalse
)
138 { return xref
->okToChange(ignoreOwnerPW
); }
139 GBool
okToCopy(GBool ignoreOwnerPW
= gFalse
)
140 { return xref
->okToCopy(ignoreOwnerPW
); }
141 GBool
okToAddNotes(GBool ignoreOwnerPW
= gFalse
)
142 { return xref
->okToAddNotes(ignoreOwnerPW
); }
144 // Is this document linearized?
145 GBool
isLinearized();
147 // Return the document's Info dictionary (if any).
148 xObject
*getDocInfo(xObject
*obj
) { return xref
->getDocInfo(obj
); }
149 xObject
*getDocInfoNF(xObject
*obj
) { return xref
->getDocInfoNF(obj
); }
151 // Return the PDF version specified by the file.
152 double getPDFVersion() { return pdfVersion
; }
154 // Save this file with another name.
155 GBool
saveAs(GString
*name
);
157 // Return a pointer to the GUI (XPDFCore or WinPDFCore xObject).
158 void *getGUIData() { return guiData
; }
163 GBool
setup(GString
*ownerPassword
, GString
*userPassword
);
165 GBool
checkEncryption(GString
*ownerPassword
, GString
*userPassword
);
174 #ifndef DISABLE_OUTLINE