1
//========================================================================
5
// Copyright 1996 Derek B. Noonburg
7
//========================================================================
22
//------------------------------------------------------------------------
24
//------------------------------------------------------------------------
35
// Constructor. Read xref table from stream.
36
XRef(BaseStream *strA, GString *ownerPassword, GString *userPassword);
41
// Is xref table valid?
42
GBool isOk() { return ok; }
44
// Is the file encrypted?
46
GBool isEncrypted() { return encrypted; }
48
GBool isEncrypted() { return gFalse; }
51
// Check various permissions.
52
GBool okToPrint(GBool ignoreOwnerPW = gFalse);
53
GBool okToChange(GBool ignoreOwnerPW = gFalse);
54
GBool okToCopy(GBool ignoreOwnerPW = gFalse);
55
GBool okToAddNotes(GBool ignoreOwnerPW = gFalse);
57
// Get catalog object.
58
Object *getCatalog(Object *obj) { return fetch(rootNum, rootGen, obj); }
60
// Fetch an indirect reference.
61
Object *fetch(int num, int gen, Object *obj);
63
// Return the document's Info dictionary (if any).
64
Object *getDocInfo(Object *obj);
66
// Return the number of objects in the xref table.
67
int getNumObjects() { return size; }
69
// Return the offset of the last xref table.
70
int getLastXRefPos() { return lastXRefPos; }
72
// Return the catalog object reference.
73
int getRootNum() { return rootNum; }
74
int getRootGen() { return rootGen; }
76
// Get end position for a stream in a damaged file.
77
// Returns -1 if unknown or file is not damaged.
78
int getStreamEnd(int streamStart);
82
BaseStream *str; // input stream
83
int start; // offset in file (to allow for garbage
84
// at beginning of file)
85
XRefEntry *entries; // xref entries
86
int size; // size of <entries> array
87
int rootNum, rootGen; // catalog dict
88
GBool ok; // true if xref table is valid
89
Object trailerDict; // trailer dictionary
90
int lastXRefPos; // offset of last xref table
91
int *streamEnds; // 'endstream' positions - only used in
93
int streamEndsLen; // number of valid entries in streamEnds
95
GBool encrypted; // true if file is encrypted
96
int encVersion; // encryption algorithm
97
int encRevision; // security handler revision
98
int keyLength; // length of key, in bytes
99
int permFlags; // permission bits
100
Guchar fileKey[16]; // file decryption key
101
GBool ownerPasswordOk; // true if owner password is correct
105
GBool readXRef(int *pos);
106
GBool constructXRef();
107
GBool checkEncrypted(GString *ownerPassword, GString *userPassword);
110
//------------------------------------------------------------------------
111
// The global xref table
112
//------------------------------------------------------------------------