1 //========================================================================
5 // Copyright 1996-2003 Glyph & Cog, LLC
7 //========================================================================
12 #ifdef USE_GCC_PRAGMAS
30 //------------------------------------------------------------------------
32 //------------------------------------------------------------------------
37 PDFDoc(GooString
*fileNameA
, GooString
*ownerPassword
= NULL
,
38 GooString
*userPassword
= NULL
, void *guiDataA
= NULL
);
41 PDFDoc(wchar_t *fileNameA
, int fileNameLen
, GooString
*ownerPassword
= NULL
,
42 GooString
*userPassword
= NULL
, void *guiDataA
= NULL
);
45 PDFDoc(BaseStream
*strA
, GooString
*ownerPassword
= NULL
,
46 GooString
*userPassword
= NULL
, void *guiDataA
= NULL
);
49 // Was PDF document successfully opened?
50 GBool
isOk() { return ok
; }
52 // Get the error code (if isOk() returns false).
53 int getErrorCode() { return errCode
; }
56 GooString
*getFileName() { return fileName
; }
58 // Get the xref table.
59 XRef
*getXRef() { return xref
; }
62 Catalog
*getCatalog() { return catalog
; }
65 BaseStream
*getBaseStream() { return str
; }
67 // Get page parameters.
68 double getPageMediaWidth(int page
)
69 { return catalog
->getPage(page
)->getMediaWidth(); }
70 double getPageMediaHeight(int page
)
71 { return catalog
->getPage(page
)->getMediaHeight(); }
72 double getPageCropWidth(int page
)
73 { return catalog
->getPage(page
)->getCropWidth(); }
74 double getPageCropHeight(int page
)
75 { return catalog
->getPage(page
)->getCropHeight(); }
76 int getPageRotate(int page
)
77 { return catalog
->getPage(page
)->getRotate(); }
79 // Get number of pages.
80 int getNumPages() { return catalog
->getNumPages(); }
82 // Return the contents of the metadata stream, or NULL if there is
84 GooString
*readMetadata() { return catalog
->readMetadata(); }
86 // Return the structure tree root object.
87 Object
*getStructTreeRoot() { return catalog
->getStructTreeRoot(); }
90 void displayPage(OutputDev
*out
, int page
, double hDPI
, double vDPI
,
91 int rotate
, GBool useMediaBox
, GBool crop
, GBool doLinks
,
92 GBool (*abortCheckCbk
)(void *data
) = NULL
,
93 void *abortCheckCbkData
= NULL
,
94 GBool (*annotDisplayDecideCbk
)(Annot
*annot
, void *user_data
) = NULL
,
95 void *annotDisplayDecideCbkData
= NULL
);
97 // Display a range of pages.
98 void displayPages(OutputDev
*out
, int firstPage
, int lastPage
,
99 double hDPI
, double vDPI
, int rotate
,
100 GBool useMediaBox
, GBool crop
, GBool doLinks
,
101 GBool (*abortCheckCbk
)(void *data
) = NULL
,
102 void *abortCheckCbkData
= NULL
,
103 GBool (*annotDisplayDecideCbk
)(Annot
*annot
, void *user_data
) = NULL
,
104 void *annotDisplayDecideCbkData
= NULL
);
106 // Display part of a page.
107 void displayPageSlice(OutputDev
*out
, int page
,
108 double hDPI
, double vDPI
,
109 int rotate
, GBool useMediaBox
, GBool crop
, GBool doLinks
,
110 int sliceX
, int sliceY
, int sliceW
, int sliceH
,
111 GBool (*abortCheckCbk
)(void *data
) = NULL
,
112 void *abortCheckCbkData
= NULL
,
113 GBool (*annotDisplayDecideCbk
)(Annot
*annot
, void *user_data
) = NULL
,
114 void *annotDisplayDecideCbkData
= NULL
);
116 // Find a page, given its object ID. Returns page number, or 0 if
118 int findPage(int num
, int gen
) { return catalog
->findPage(num
, gen
); }
120 // Returns the links for the current page, transferring ownership to
124 // Find a named destination. Returns the link destination, or
125 // NULL if <name> is not a destination.
126 LinkDest
*findDest(UGooString
*name
)
127 { return catalog
->findDest(name
); }
129 #ifndef DISABLE_OUTLINE
130 // Return the outline object.
131 Outline
*getOutline() { return outline
; }
134 // Is the file encrypted?
135 GBool
isEncrypted() { return xref
->isEncrypted(); }
137 // Check various permissions.
138 GBool
okToPrint(GBool ignoreOwnerPW
= gFalse
)
139 { return xref
->okToPrint(ignoreOwnerPW
); }
140 GBool
okToPrintHighRes(GBool ignoreOwnerPW
= gFalse
)
141 { return xref
->okToPrintHighRes(ignoreOwnerPW
); }
142 GBool
okToChange(GBool ignoreOwnerPW
= gFalse
)
143 { return xref
->okToChange(ignoreOwnerPW
); }
144 GBool
okToCopy(GBool ignoreOwnerPW
= gFalse
)
145 { return xref
->okToCopy(ignoreOwnerPW
); }
146 GBool
okToAddNotes(GBool ignoreOwnerPW
= gFalse
)
147 { return xref
->okToAddNotes(ignoreOwnerPW
); }
148 GBool
okToFillForm(GBool ignoreOwnerPW
= gFalse
)
149 { return xref
->okToFillForm(ignoreOwnerPW
); }
150 GBool
okToAccessibility(GBool ignoreOwnerPW
= gFalse
)
151 { return xref
->okToAccessibility(ignoreOwnerPW
); }
152 GBool
okToAssemble(GBool ignoreOwnerPW
= gFalse
)
153 { return xref
->okToAssemble(ignoreOwnerPW
); }
156 // Is this document linearized?
157 GBool
isLinearized();
159 // Return the document's Info dictionary (if any).
160 Object
*getDocInfo(Object
*obj
) { return xref
->getDocInfo(obj
); }
161 Object
*getDocInfoNF(Object
*obj
) { return xref
->getDocInfoNF(obj
); }
163 // Return the PDF version specified by the file.
164 double getPDFVersion() { return pdfVersion
; }
166 // Save this file with another name.
167 GBool
saveAs(GooString
*name
);
169 // Return a pointer to the GUI (XPDFCore or WinPDFCore object).
170 void *getGUIData() { return guiData
; }
174 GBool
setup(GooString
*ownerPassword
, GooString
*userPassword
);
177 GBool
checkEncryption(GooString
*ownerPassword
, GooString
*userPassword
);
178 void getLinks(Page
*page
);
188 #ifndef DISABLE_OUTLINE