#ifndef PDFDOC_H
#define PDFDOC_H
#include <config.h>
#ifdef USE_GCC_PRAGMAS
#pragma interface
#endif
#include <stdio.h>
#include "XRef.h"
#include "Catalog.h"
#include "Page.h"
class GString;
class BaseStream;
class OutputDev;
class Links;
class LinkAction;
class LinkDest;
class Outline;
class PDFDoc {
public:
PDFDoc(GString *fileNameA, GString *ownerPassword = NULL,
GString *userPassword = NULL, void *guiDataA = NULL);
#ifdef WIN32
PDFDoc(wchar_t *fileNameA, int fileNameLen, GString *ownerPassword = NULL,
GString *userPassword = NULL, void *guiDataA = NULL);
#endif
PDFDoc(BaseStream *strA, GString *ownerPassword = NULL,
GString *userPassword = NULL, void *guiDataA = NULL);
~PDFDoc();
GBool isOk() { return ok; }
int getErrorCode() { return errCode; }
GString *getFileName() { return fileName; }
XRef *getXRef() { return xref; }
Catalog *getCatalog() { return catalog; }
BaseStream *getBaseStream() { return str; }
double getPageMediaWidth(int page)
{ return catalog->getPage(page)->getMediaWidth(); }
double getPageMediaHeight(int page)
{ return catalog->getPage(page)->getMediaHeight(); }
double getPageCropWidth(int page)
{ return catalog->getPage(page)->getCropWidth(); }
double getPageCropHeight(int page)
{ return catalog->getPage(page)->getCropHeight(); }
int getPageRotate(int page)
{ return catalog->getPage(page)->getRotate(); }
int getNumPages() { return catalog->getNumPages(); }
GString *readMetadata() { return catalog->readMetadata(); }
Object *getStructTreeRoot() { return catalog->getStructTreeRoot(); }
void displayPage(OutputDev *out, int page, double hDPI, double vDPI,
int rotate, GBool useMediaBox, GBool crop,
GBool doLinks,
GBool (*abortCheckCbk)(void *data) = NULL,
void *abortCheckCbkData = NULL);
void displayPages(OutputDev *out, int firstPage, int lastPage,
double hDPI, double vDPI, int rotate,
GBool useMediaBox, GBool crop, GBool doLinks,
GBool (*abortCheckCbk)(void *data) = NULL,
void *abortCheckCbkData = NULL);
void displayPageSlice(OutputDev *out, int page,
double hDPI, double vDPI, int rotate,
GBool useMediaBox, GBool crop, GBool doLinks,
int sliceX, int sliceY, int sliceW, int sliceH,
GBool (*abortCheckCbk)(void *data) = NULL,
void *abortCheckCbkData = NULL);
int findPage(int num, int gen) { return catalog->findPage(num, gen); }
Links *takeLinks();
LinkDest *findDest(GString *name)
{ return catalog->findDest(name); }
#ifndef DISABLE_OUTLINE
Outline *getOutline() { return outline; }
#endif
GBool isEncrypted() { return xref->isEncrypted(); }
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); }
GBool isLinearized();
Object *getDocInfo(Object *obj) { return xref->getDocInfo(obj); }
Object *getDocInfoNF(Object *obj) { return xref->getDocInfoNF(obj); }
double getPDFVersion() { return pdfVersion; }
GBool saveAs(GString *name);
void *getGUIData() { return guiData; }
private:
GBool setup(GString *ownerPassword, GString *userPassword);
void checkHeader();
GBool checkEncryption(GString *ownerPassword, GString *userPassword);
void getLinks(Page *page);
GString *fileName;
FILE *file;
BaseStream *str;
void *guiData;
double pdfVersion;
XRef *xref;
Catalog *catalog;
Links *links;
#ifndef DISABLE_OUTLINE
Outline *outline;
#endif
GBool ok;
int errCode;
};
#endif