X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;ds=sidebyside;f=pdf%2Fxpdf%2FPDFDoc.h;h=c12531e9387c76bf7c89c9a8e146cb1e9e5500e8;hb=refs%2Ftags%2FGPDF_FOR_GNOME_1_4;hp=b978bc7df1ed373d8c8b9e28532ed8ce600da537;hpb=6bf8080516ffe50afba89f1f07f486000423bcd8;p=evince.git diff --git a/pdf/xpdf/PDFDoc.h b/pdf/xpdf/PDFDoc.h index b978bc7d..c12531e9 100644 --- a/pdf/xpdf/PDFDoc.h +++ b/pdf/xpdf/PDFDoc.h @@ -2,7 +2,7 @@ // // PDFDoc.h // -// Copyright 1996 Derek B. Noonburg +// Copyright 1996-2002 Glyph & Cog, LLC // //======================================================================== @@ -14,12 +14,13 @@ #endif #include +#include "XRef.h" #include "Link.h" +#include "Catalog.h" +#include "Page.h" class GString; class BaseStream; -class XRef; -class Catalog; class OutputDev; class Links; class LinkAction; @@ -32,19 +33,30 @@ class LinkDest; class PDFDoc { public: - PDFDoc(GString *fileName1); - PDFDoc(BaseStream *str); + PDFDoc(GString *fileNameA, GString *ownerPassword = NULL, + GString *userPassword = NULL, GBool printCommandsA = gFalse); + PDFDoc(BaseStream *strA, GString *ownerPassword = NULL, + GString *userPassword = NULL, GBool printCommandsA = gFalse); ~PDFDoc(); // Was PDF document successfully opened? GBool isOk() { return ok; } + // Get the error code (if isOk() returns false). + int getErrorCode() { return errCode; } + // Get file name. GString *getFileName() { return fileName; } + // Get the xref table. + XRef *getXRef() { return xref; } + // Get catalog. Catalog *getCatalog() { return catalog; } + // Get base stream. + BaseStream *getBaseStream() { return str; } + // Get page parameters. double getPageWidth(int page) { return catalog->getPage(page)->getWidth(); } @@ -56,13 +68,20 @@ public: // Get number of pages. int getNumPages() { return catalog->getNumPages(); } + // Return the contents of the metadata stream, or NULL if there is + // no metadata. + GString *readMetadata() { return catalog->readMetadata(); } + + // Return the structure tree root object. + Object *getStructTreeRoot() { return catalog->getStructTreeRoot(); } + // Display a page. - void displayPage(OutputDev *out, int page, int zoom, int rotate, - GBool doLinks); + void displayPage(OutputDev *out, int page, double zoom, + int rotate, GBool doLinks); // Display a range of pages. void displayPages(OutputDev *out, int firstPage, int lastPage, - int zoom, int rotate); + int zoom, int rotate, GBool doLinks); // Find a page, given its object ID. Returns page number, or 0 if // not found. @@ -83,30 +102,45 @@ public: // Is the file encrypted? GBool isEncrypted() { return xref->isEncrypted(); } - // Are printing and copying allowed? If not, print an error message. - GBool okToPrint() { return xref->okToPrint(); } - GBool okToCopy() { return xref->okToCopy(); } + // Check various permissions. + GBool okToPrint(GBool ignoreOwnerPW = gFalse) + { return xref->okToPrint(ignoreOwnerPW); } + GBool okToChange(GBool ignoreOwnerPW = gFalse) + { return xref->okToChange(ignoreOwnerPW); } + GBool okToCopy(GBool ignoreOwnerPW = gFalse) + { return xref->okToCopy(ignoreOwnerPW); } + GBool okToAddNotes(GBool ignoreOwnerPW = gFalse) + { return xref->okToAddNotes(ignoreOwnerPW); } + + // Is this document linearized? + GBool isLinearized(); // Return the document's Info dictionary (if any). Object *getDocInfo(Object *obj) { return xref->getDocInfo(obj); } + // Return the PDF version specified by the file. + double getPDFVersion() { return pdfVersion; } + // Save this file with another name. GBool saveAs(GString *name); private: - GBool setup(); + GBool setup(GString *ownerPassword, GString *userPassword); void checkHeader(); - void getLinks(int page); + void getLinks(Page *page); GString *fileName; FILE *file; BaseStream *str; + double pdfVersion; XRef *xref; Catalog *catalog; Links *links; + GBool printCommands; GBool ok; + int errCode; }; #endif