1 //========================================================================
5 // Copyright 1996-2002 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 zoom,
83 int rotate, 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 int zoom, int rotate, GBool doLinks,
90 GBool (*abortCheckCbk)(void *data) = NULL,
91 void *abortCheckCbkData = NULL);
93 // Display part of a page.
94 void displayPageSlice(OutputDev *out, int page, double zoom,
95 int rotate, int sliceX, int sliceY,
96 int sliceW, int sliceH,
97 GBool (*abortCheckCbk)(void *data) = NULL,
98 void *abortCheckCbkData = NULL);
100 // Find a page, given its object ID. Returns page number, or 0 if
102 int findPage(int num, int gen) { return catalog->findPage(num, gen); }
104 // If point <x>,<y> is in a link, return the associated action;
106 LinkAction *findLink(double x, double y) { return links->find(x, y); }
108 // Return true if <x>,<y> is in a link.
109 GBool onLink(double x, double y) { return links->onLink(x, y); }
111 // Find a named destination. Returns the link destination, or
112 // NULL if <name> is not a destination.
113 LinkDest *findDest(GString *name)
114 { return catalog->findDest(name); }
116 #ifndef DISABLE_OUTLINE
117 // Return the outline object.
118 Outline *getOutline() { return outline; }
121 // Is the file encrypted?
122 GBool isEncrypted() { return xref->isEncrypted(); }
124 // Check various permissions.
125 GBool okToPrint(GBool ignoreOwnerPW = gFalse)
126 { return xref->okToPrint(ignoreOwnerPW); }
127 GBool okToChange(GBool ignoreOwnerPW = gFalse)
128 { return xref->okToChange(ignoreOwnerPW); }
129 GBool okToCopy(GBool ignoreOwnerPW = gFalse)
130 { return xref->okToCopy(ignoreOwnerPW); }
131 GBool okToAddNotes(GBool ignoreOwnerPW = gFalse)
132 { return xref->okToAddNotes(ignoreOwnerPW); }
134 // Is this document linearized?
135 GBool isLinearized();
137 // Return the document's Info dictionary (if any).
138 Object *getDocInfo(Object *obj) { return xref->getDocInfo(obj); }
139 Object *getDocInfoNF(Object *obj) { return xref->getDocInfoNF(obj); }
141 // Return the PDF version specified by the file.
142 double getPDFVersion() { return pdfVersion; }
144 // Save this file with another name.
145 GBool saveAs(GString *name);
150 GBool setup(GString *ownerPassword, GString *userPassword);
152 void getLinks(Page *page);
161 #ifndef DISABLE_OUTLINE