1 //========================================================================
5 // Copyright 1996-2003 Glyph & Cog, LLC
7 //========================================================================
14 #ifdef USE_GCC_PRAGMAS
32 //------------------------------------------------------------------------
34 //------------------------------------------------------------------------
39 PDFDoc(GString
*fileNameA
, GString
*ownerPassword
= NULL
,
40 GString
*userPassword
= NULL
);
41 PDFDoc(BaseStream
*strA
, GString
*ownerPassword
= NULL
,
42 GString
*userPassword
= NULL
);
45 // Was PDF document successfully opened?
46 GBool
isOk() { return ok
; }
48 // Get the error code (if isOk() returns false).
49 int getErrorCode() { return errCode
; }
52 GString
*getFileName() { return fileName
; }
54 // Get the xref table.
55 XRef
*getXRef() { return xref
; }
58 Catalog
*getCatalog() { return catalog
; }
61 BaseStream
*getBaseStream() { return str
; }
63 // Get page parameters.
64 double getPageWidth(int page
)
65 { return catalog
->getPage(page
)->getWidth(); }
66 double getPageHeight(int page
)
67 { return catalog
->getPage(page
)->getHeight(); }
68 int getPageRotate(int page
)
69 { return catalog
->getPage(page
)->getRotate(); }
71 // Get number of pages.
72 int getNumPages() { return catalog
->getNumPages(); }
74 // Return the contents of the metadata stream, or NULL if there is
76 GString
*readMetadata() { return catalog
->readMetadata(); }
78 // Return the structure tree root object.
79 Object
*getStructTreeRoot() { return catalog
->getStructTreeRoot(); }
82 void displayPage(OutputDev
*out
, int page
, double hDPI
, double vDPI
,
83 int rotate
, GBool crop
, GBool doLinks
,
84 GBool (*abortCheckCbk
)(void *data
) = NULL
,
85 void *abortCheckCbkData
= NULL
);
87 // Display a range of pages.
88 void displayPages(OutputDev
*out
, int firstPage
, int lastPage
,
89 double hDPI
, double vDPI
, int rotate
,
90 GBool crop
, GBool doLinks
,
91 GBool (*abortCheckCbk
)(void *data
) = NULL
,
92 void *abortCheckCbkData
= NULL
);
94 // Display part of a page.
95 void displayPageSlice(OutputDev
*out
, int page
,
96 double hDPI
, double vDPI
,
97 int rotate
, GBool crop
,
98 int sliceX
, int sliceY
, int sliceW
, int sliceH
,
99 GBool (*abortCheckCbk
)(void *data
) = NULL
,
100 void *abortCheckCbkData
= NULL
);
102 // Find a page, given its object ID. Returns page number, or 0 if
104 int findPage(int num
, int gen
) { return catalog
->findPage(num
, gen
); }
106 // If point <x>,<y> is in a link, return the associated action;
108 LinkAction
*findLink(double x
, double y
)
109 { return links
? links
->find(x
, y
) : (LinkAction
*)NULL
; }
111 // Return true if <x>,<y> is in a link.
112 GBool
onLink(double x
, double y
) { return links
->onLink(x
, y
); }
114 // Find a named destination. Returns the link destination, or
115 // NULL if <name> is not a destination.
116 LinkDest
*findDest(GString
*name
)
117 { return catalog
->findDest(name
); }
119 #ifndef DISABLE_OUTLINE
120 // Return the outline object.
121 Outline
*getOutline() { return outline
; }
124 // Is the file encrypted?
125 GBool
isEncrypted() { return xref
->isEncrypted(); }
127 // Check various permissions.
128 GBool
okToPrint(GBool ignoreOwnerPW
= gFalse
)
129 { return xref
->okToPrint(ignoreOwnerPW
); }
130 GBool
okToChange(GBool ignoreOwnerPW
= gFalse
)
131 { return xref
->okToChange(ignoreOwnerPW
); }
132 GBool
okToCopy(GBool ignoreOwnerPW
= gFalse
)
133 { return xref
->okToCopy(ignoreOwnerPW
); }
134 GBool
okToAddNotes(GBool ignoreOwnerPW
= gFalse
)
135 { return xref
->okToAddNotes(ignoreOwnerPW
); }
137 // Is this document linearized?
138 GBool
isLinearized();
140 // Return the document's Info dictionary (if any).
141 Object
*getDocInfo(Object
*obj
) { return xref
->getDocInfo(obj
); }
142 Object
*getDocInfoNF(Object
*obj
) { return xref
->getDocInfoNF(obj
); }
144 // Return the PDF version specified by the file.
145 double getPDFVersion() { return pdfVersion
; }
147 // Save this file with another name.
148 GBool
saveAs(GString
*name
);
153 GBool
setup(GString
*ownerPassword
, GString
*userPassword
);
155 void getLinks(Page
*page
);
164 #ifndef DISABLE_OUTLINE