1 //========================================================================
5 // Copyright 1996-2002 Glyph & Cog, LLC
7 //========================================================================
29 //------------------------------------------------------------------------
31 //------------------------------------------------------------------------
36 PDFDoc(GString *fileNameA, GString *ownerPassword = NULL,
37 GString *userPassword = NULL, GBool printCommandsA = gFalse);
38 PDFDoc(BaseStream *strA, GString *ownerPassword = NULL,
39 GString *userPassword = NULL, GBool printCommandsA = gFalse);
42 // Was PDF document successfully opened?
43 GBool isOk() { return ok; }
45 // Get the error code (if isOk() returns false).
46 int getErrorCode() { return errCode; }
49 GString *getFileName() { return fileName; }
51 // Get the xref table.
52 XRef *getXRef() { return xref; }
55 Catalog *getCatalog() { return catalog; }
58 BaseStream *getBaseStream() { return str; }
60 // Get page parameters.
61 double getPageWidth(int page)
62 { return catalog->getPage(page)->getWidth(); }
63 double getPageHeight(int page)
64 { return catalog->getPage(page)->getHeight(); }
65 int getPageRotate(int page)
66 { return catalog->getPage(page)->getRotate(); }
68 // Get number of pages.
69 int getNumPages() { return catalog->getNumPages(); }
71 // Return the contents of the metadata stream, or NULL if there is
73 GString *readMetadata() { return catalog->readMetadata(); }
75 // Return the structure tree root object.
76 Object *getStructTreeRoot() { return catalog->getStructTreeRoot(); }
79 void displayPage(OutputDev *out, int page, double zoom,
80 int rotate, GBool doLinks);
82 // Display a range of pages.
83 void displayPages(OutputDev *out, int firstPage, int lastPage,
84 int zoom, int rotate, GBool doLinks);
86 // Find a page, given its object ID. Returns page number, or 0 if
88 int findPage(int num, int gen) { return catalog->findPage(num, gen); }
90 // If point <x>,<y> is in a link, return the associated action;
92 LinkAction *findLink(double x, double y) { return links->find(x, y); }
94 // Return true if <x>,<y> is in a link.
95 GBool onLink(double x, double y) { return links->onLink(x, y); }
97 // Find a named destination. Returns the link destination, or
98 // NULL if <name> is not a destination.
99 LinkDest *findDest(GString *name)
100 { return catalog->findDest(name); }
102 // Is the file encrypted?
103 GBool isEncrypted() { return xref->isEncrypted(); }
105 // Check various permissions.
106 GBool okToPrint(GBool ignoreOwnerPW = gFalse)
107 { return xref->okToPrint(ignoreOwnerPW); }
108 GBool okToChange(GBool ignoreOwnerPW = gFalse)
109 { return xref->okToChange(ignoreOwnerPW); }
110 GBool okToCopy(GBool ignoreOwnerPW = gFalse)
111 { return xref->okToCopy(ignoreOwnerPW); }
112 GBool okToAddNotes(GBool ignoreOwnerPW = gFalse)
113 { return xref->okToAddNotes(ignoreOwnerPW); }
115 // Is this document linearized?
116 GBool isLinearized();
118 // Return the document's Info dictionary (if any).
119 Object *getDocInfo(Object *obj) { return xref->getDocInfo(obj); }
121 // Return the PDF version specified by the file.
122 double getPDFVersion() { return pdfVersion; }
124 // Save this file with another name.
125 GBool saveAs(GString *name);
129 GBool setup(GString *ownerPassword, GString *userPassword);
131 void getLinks(Page *page);