filters
PDFDoc.h00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef PDFDOC_H
00010 #define PDFDOC_H
00011
00012 #include <aconf.h>
00013
00014 #ifdef USE_GCC_PRAGMAS
00015 #pragma interface
00016 #endif
00017
00018 #include <stdio.h>
00019 #include "XRef.h"
00020 #include "Link.h"
00021 #include "Catalog.h"
00022 #include "Page.h"
00023
00024 class GString;
00025 class BaseStream;
00026 class OutputDev;
00027 class Links;
00028 class LinkAction;
00029 class LinkDest;
00030 class Outline;
00031
00032
00033
00034
00035
00036 class PDFDoc {
00037 public:
00038
00039 PDFDoc(GString *fileNameA, GString *ownerPassword = NULL,
00040 GString *userPassword = NULL);
00041 PDFDoc(BaseStream *strA, GString *ownerPassword = NULL,
00042 GString *userPassword = NULL);
00043 ~PDFDoc();
00044
00045
00046 GBool isOk() { return ok; }
00047
00048
00049 int getErrorCode() { return errCode; }
00050
00051
00052 GString *getFileName() { return fileName; }
00053
00054
00055 XRef *getXRef() { return xref; }
00056
00057
00058 Catalog *getCatalog() { return catalog; }
00059
00060
00061 BaseStream *getBaseStream() { return str; }
00062
00063
00064 double getPageWidth(int page)
00065 { return catalog->getPage(page)->getWidth(); }
00066 double getPageHeight(int page)
00067 { return catalog->getPage(page)->getHeight(); }
00068 int getPageRotate(int page)
00069 { return catalog->getPage(page)->getRotate(); }
00070
00071
00072 int getNumPages() { return catalog->getNumPages(); }
00073
00074
00075
00076 GString *readMetadata() { return catalog->readMetadata(); }
00077
00078
00079 Object *getStructTreeRoot() { return catalog->getStructTreeRoot(); }
00080
00081
00082 void displayPage(OutputDev *out, int page, double zoom,
00083 int rotate, GBool doLinks,
00084 GBool (*abortCheckCbk)(void *data) = NULL,
00085 void *abortCheckCbkData = NULL);
00086
00087
00088 void displayPages(OutputDev *out, int firstPage, int lastPage,
00089 int zoom, int rotate, GBool doLinks,
00090 GBool (*abortCheckCbk)(void *data) = NULL,
00091 void *abortCheckCbkData = NULL);
00092
00093
00094 void displayPageSlice(OutputDev *out, int page, double zoom,
00095 int rotate, int sliceX, int sliceY,
00096 int sliceW, int sliceH,
00097 GBool (*abortCheckCbk)(void *data) = NULL,
00098 void *abortCheckCbkData = NULL);
00099
00100
00101
00102 int findPage(int num, int gen) { return catalog->findPage(num, gen); }
00103
00104
00105
00106 LinkAction *findLink(double x, double y) { return links->find(x, y); }
00107
00108
00109 GBool onLink(double x, double y) { return links->onLink(x, y); }
00110
00111
00112
00113 LinkDest *findDest(GString *name)
00114 { return catalog->findDest(name); }
00115
00116 #ifndef DISABLE_OUTLINE
00117
00118 Outline *getOutline() { return outline; }
00119 #endif
00120
00121
00122 GBool isEncrypted() { return xref->isEncrypted(); }
00123
00124
00125 GBool okToPrint(GBool ignoreOwnerPW = gFalse)
00126 { return xref->okToPrint(ignoreOwnerPW); }
00127 GBool okToChange(GBool ignoreOwnerPW = gFalse)
00128 { return xref->okToChange(ignoreOwnerPW); }
00129 GBool okToCopy(GBool ignoreOwnerPW = gFalse)
00130 { return xref->okToCopy(ignoreOwnerPW); }
00131 GBool okToAddNotes(GBool ignoreOwnerPW = gFalse)
00132 { return xref->okToAddNotes(ignoreOwnerPW); }
00133
00134
00135 GBool isLinearized();
00136
00137
00138 Object *getDocInfo(Object *obj) { return xref->getDocInfo(obj); }
00139 Object *getDocInfoNF(Object *obj) { return xref->getDocInfoNF(obj); }
00140
00141
00142 double getPDFVersion() { return pdfVersion; }
00143
00144
00145 GBool saveAs(GString *name);
00146
00147
00148 private:
00149
00150 GBool setup(GString *ownerPassword, GString *userPassword);
00151 void checkHeader();
00152 void getLinks(Page *page);
00153
00154 GString *fileName;
00155 FILE *file;
00156 BaseStream *str;
00157 double pdfVersion;
00158 XRef *xref;
00159 Catalog *catalog;
00160 Links *links;
00161 #ifndef DISABLE_OUTLINE
00162 Outline *outline;
00163 #endif
00164
00165
00166 GBool ok;
00167 int errCode;
00168 };
00169
00170 #endif
|