PDFDoc.h 16.7 KB
Newer Older
Kristian Høgsberg's avatar
Kristian Høgsberg committed
1 2 3 4 5 6 7 8
//========================================================================
//
// PDFDoc.h
//
// Copyright 1996-2003 Glyph & Cog, LLC
//
//========================================================================

9 10 11 12
//========================================================================
//
// Modified under the Poppler project - http://poppler.freedesktop.org
//
13 14 15
// All changes made under the Poppler project to this file are licensed
// under GPL version 2 or later
//
16
// Copyright (C) 2005, 2006, 2008 Brad Hards <bradh@frogmouth.net>
17
// Copyright (C) 2005, 2009, 2014, 2015, 2017, 2018 Albert Astals Cid <aacid@kde.org>
18 19 20
// Copyright (C) 2008 Julien Rebetez <julienr@svn.gnome.org>
// Copyright (C) 2008 Pino Toscano <pino@kde.org>
// Copyright (C) 2008 Carlos Garcia Campos <carlosgc@gnome.org>
21
// Copyright (C) 2009 Eric Toombs <ewtoombs@uwaterloo.ca>
22
// Copyright (C) 2009 Kovid Goyal <kovid@kovidgoyal.net>
Albert Astals Cid's avatar
Albert Astals Cid committed
23
// Copyright (C) 2010, 2014 Hib Eris <hib@hiberis.nl>
Albert Astals Cid's avatar
Albert Astals Cid committed
24
// Copyright (C) 2010 Srinivas Adicherla <srinivas.adicherla@geodesic.com>
25
// Copyright (C) 2011, 2013, 2014, 2016 Thomas Freitag <Thomas.Freitag@alfa.de>
26
// Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it>
27
// Copyright (C) 2013, 2017 Adrian Johnson <ajohnson@redneon.com>
Albert Astals Cid's avatar
Albert Astals Cid committed
28
// Copyright (C) 2013 Adam Reichold <adamreichold@myopera.com>
Albert Astals Cid's avatar
Albert Astals Cid committed
29
// Copyright (C) 2013 Adrian Perez de Castro <aperez@igalia.com>
30 31
// Copyright (C) 2015 André Guerreiro <aguerreiro1985@gmail.com>
// Copyright (C) 2015 André Esser <bepandre@hotmail.com>
Jakub Alba's avatar
Jakub Alba committed
32
// Copyright (C) 2016 Jakub Alba <jakubalba@gmail.com>
Albert Astals Cid's avatar
Albert Astals Cid committed
33
// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich
34
// Copyright (C) 2018 Evangelos Rigas <erigas@rnd2.org>
35 36 37 38 39 40
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
//
//========================================================================

Kristian Høgsberg's avatar
Kristian Høgsberg committed
41 42 43 44 45 46 47
#ifndef PDFDOC_H
#define PDFDOC_H

#ifdef USE_GCC_PRAGMAS
#pragma interface
#endif

48 49
#include <mutex>

50
#include "poppler-config.h"
Kristian Høgsberg's avatar
Kristian Høgsberg committed
51 52 53 54 55
#include <stdio.h>
#include "XRef.h"
#include "Catalog.h"
#include "Page.h"
#include "Annot.h"
56
#include "Form.h"
57
#include "OptionalContent.h"
58
#include "Stream.h"
Kristian Høgsberg's avatar
Kristian Høgsberg committed
59 60

class GooString;
61
class GooFile;
Kristian Høgsberg's avatar
Kristian Høgsberg committed
62 63 64 65 66 67
class BaseStream;
class OutputDev;
class Links;
class LinkAction;
class LinkDest;
class Outline;
Hib Eris's avatar
Hib Eris committed
68 69 70
class Linearization;
class SecurityHandler;
class Hints;
71
class StructTreeRoot;
Kristian Høgsberg's avatar
Kristian Høgsberg committed
72

73 74 75
enum PDFWriteMode {
  writeStandard,
  writeForceRewrite,
Albert Astals Cid's avatar
Albert Astals Cid committed
76
  writeForceIncremental
77 78
};

79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
enum PDFSubtype {
  subtypeNull,
  subtypePDFA,
  subtypePDFE,
  subtypePDFUA,
  subtypePDFVT,
  subtypePDFX,
  subtypeNone
};

enum PDFSubtypePart {
  subtypePartNull,
  subtypePart1,
  subtypePart2,
  subtypePart3,
  subtypePart4,
  subtypePart5,
  subtypePart6,
  subtypePart7,
  subtypePart8,
  subtypePartNone
};

enum PDFSubtypeConformance {
  subtypeConfNull,
  subtypeConfA,
  subtypeConfB,
  subtypeConfG,
  subtypeConfN,
  subtypeConfP,
  subtypeConfPG,
  subtypeConfU,
  subtypeConfNone
};

Kristian Høgsberg's avatar
Kristian Høgsberg committed
114 115 116 117 118 119 120 121
//------------------------------------------------------------------------
// PDFDoc
//------------------------------------------------------------------------

class PDFDoc {
public:

  PDFDoc(GooString *fileNameA, GooString *ownerPassword = NULL,
122
	 GooString *userPassword = NULL, void *guiDataA = NULL);
123

124
#ifdef _WIN32
125 126 127 128
  PDFDoc(wchar_t *fileNameA, int fileNameLen, GooString *ownerPassword = NULL,
	 GooString *userPassword = NULL, void *guiDataA = NULL);
#endif

Kristian Høgsberg's avatar
Kristian Høgsberg committed
129
  PDFDoc(BaseStream *strA, GooString *ownerPassword = NULL,
130
	 GooString *userPassword = NULL, void *guiDataA = NULL);
Kristian Høgsberg's avatar
Kristian Høgsberg committed
131 132
  ~PDFDoc();

133 134 135
  PDFDoc(const PDFDoc &) = delete;
  PDFDoc& operator=(const PDFDoc &) = delete;

Hib Eris's avatar
Hib Eris committed
136 137
  static PDFDoc *ErrorPDFDoc(int errorCode, GooString *fileNameA = NULL);

Kristian Høgsberg's avatar
Kristian Høgsberg committed
138 139 140 141 142 143
  // Was PDF document successfully opened?
  GBool isOk() { return ok; }

  // Get the error code (if isOk() returns false).
  int getErrorCode() { return errCode; }

144 145 146 147
  // Get the error code returned by fopen() (if getErrorCode() == 
  // errOpenFile).
  int getFopenErrno() { return fopenErrno; }

Kristian Høgsberg's avatar
Kristian Høgsberg committed
148 149
  // Get file name.
  GooString *getFileName() { return fileName; }
150 151 152
#ifdef _WIN32
  wchar_t *getFileNameU() { return fileNameU; }
#endif
Kristian Høgsberg's avatar
Kristian Høgsberg committed
153

Hib Eris's avatar
Hib Eris committed
154 155
  // Get the linearization table.
  Linearization *getLinearization();
156
  GBool checkLinearization();
Hib Eris's avatar
Hib Eris committed
157

Kristian Høgsberg's avatar
Kristian Høgsberg committed
158 159 160 161 162 163
  // Get the xref table.
  XRef *getXRef() { return xref; }

  // Get catalog.
  Catalog *getCatalog() { return catalog; }

164 165 166
  // Get optional content configuration
  OCGs *getOptContentConfig() { return catalog->getOptContentConfig(); }

Kristian Høgsberg's avatar
Kristian Høgsberg committed
167 168 169 170
  // Get base stream.
  BaseStream *getBaseStream() { return str; }

  // Get page parameters.
171
  double getPageMediaWidth(int page)
Hib Eris's avatar
Hib Eris committed
172
    { return getPage(page) ? getPage(page)->getMediaWidth() : 0.0 ; }
173
  double getPageMediaHeight(int page)
Hib Eris's avatar
Hib Eris committed
174
    { return getPage(page) ? getPage(page)->getMediaHeight() : 0.0 ; }
175
  double getPageCropWidth(int page)
Hib Eris's avatar
Hib Eris committed
176
    { return getPage(page) ? getPage(page)->getCropWidth() : 0.0 ; }
177
  double getPageCropHeight(int page)
Hib Eris's avatar
Hib Eris committed
178
    { return getPage(page) ? getPage(page)->getCropHeight() : 0.0 ; }
Kristian Høgsberg's avatar
Kristian Høgsberg committed
179
  int getPageRotate(int page)
Hib Eris's avatar
Hib Eris committed
180
    { return getPage(page) ? getPage(page)->getRotate() : 0 ; }
Kristian Høgsberg's avatar
Kristian Høgsberg committed
181 182

  // Get number of pages.
Hib Eris's avatar
Hib Eris committed
183
  int getNumPages();
Kristian Høgsberg's avatar
Kristian Høgsberg committed
184 185 186 187 188 189

  // Return the contents of the metadata stream, or NULL if there is
  // no metadata.
  GooString *readMetadata() { return catalog->readMetadata(); }

  // Return the structure tree root object.
190
  StructTreeRoot *getStructTreeRoot() { return catalog->getStructTreeRoot(); }
Kristian Høgsberg's avatar
Kristian Høgsberg committed
191

Hib Eris's avatar
Hib Eris committed
192 193 194
  // Get page.
  Page *getPage(int page);

Kristian Høgsberg's avatar
Kristian Høgsberg committed
195
  // Display a page.
196 197 198
  void displayPage(OutputDev *out, int page,
		   double hDPI, double vDPI, int rotate,
		   GBool useMediaBox, GBool crop, GBool printing,
Kristian Høgsberg's avatar
Kristian Høgsberg committed
199 200 201
		   GBool (*abortCheckCbk)(void *data) = NULL,
		   void *abortCheckCbkData = NULL,
                   GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = NULL,
202
                   void *annotDisplayDecideCbkData = NULL, GBool copyXRef = gFalse);
Kristian Høgsberg's avatar
Kristian Høgsberg committed
203 204 205 206

  // Display a range of pages.
  void displayPages(OutputDev *out, int firstPage, int lastPage,
		    double hDPI, double vDPI, int rotate,
207
		    GBool useMediaBox, GBool crop, GBool printing,
Kristian Høgsberg's avatar
Kristian Høgsberg committed
208 209 210 211 212 213 214
		    GBool (*abortCheckCbk)(void *data) = NULL,
		    void *abortCheckCbkData = NULL,
                    GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = NULL,
                    void *annotDisplayDecideCbkData = NULL);

  // Display part of a page.
  void displayPageSlice(OutputDev *out, int page,
215 216
			double hDPI, double vDPI, int rotate, 
			GBool useMediaBox, GBool crop, GBool printing,
Kristian Høgsberg's avatar
Kristian Høgsberg committed
217 218 219 220
			int sliceX, int sliceY, int sliceW, int sliceH,
			GBool (*abortCheckCbk)(void *data) = NULL,
			void *abortCheckCbkData = NULL,
                        GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = NULL,
221
                        void *annotDisplayDecideCbkData = NULL, GBool copyXRef = gFalse);
Kristian Høgsberg's avatar
Kristian Høgsberg committed
222 223 224 225 226

  // Find a page, given its object ID.  Returns page number, or 0 if
  // not found.
  int findPage(int num, int gen) { return catalog->findPage(num, gen); }

227 228
  // Returns the links for the current page, transferring ownership to
  // the caller.
229
  Links *getLinks(int page);
Kristian Høgsberg's avatar
Kristian Høgsberg committed
230 231 232

  // Find a named destination.  Returns the link destination, or
  // NULL if <name> is not a destination.
Albert Astals Cid's avatar
Albert Astals Cid committed
233
  LinkDest *findDest(const GooString *name)
Kristian Høgsberg's avatar
Kristian Høgsberg committed
234 235
    { return catalog->findDest(name); }

236 237 238 239
  // Process the links for a page.
  void processLinks(OutputDev *out, int page);


Kristian Høgsberg's avatar
Kristian Høgsberg committed
240 241
#ifndef DISABLE_OUTLINE
  // Return the outline object.
242
  Outline *getOutline();
Kristian Høgsberg's avatar
Kristian Høgsberg committed
243 244 245 246 247
#endif

  // Is the file encrypted?
  GBool isEncrypted() { return xref->isEncrypted(); }

248 249
  std::vector<FormWidgetSignature*> getSignatureWidgets();

Kristian Høgsberg's avatar
Kristian Høgsberg committed
250 251 252
  // Check various permissions.
  GBool okToPrint(GBool ignoreOwnerPW = gFalse)
    { return xref->okToPrint(ignoreOwnerPW); }
253 254
  GBool okToPrintHighRes(GBool ignoreOwnerPW = gFalse)
    { return xref->okToPrintHighRes(ignoreOwnerPW); }
Kristian Høgsberg's avatar
Kristian Høgsberg committed
255 256 257 258 259 260
  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); }
261 262 263 264 265 266 267
  GBool okToFillForm(GBool ignoreOwnerPW = gFalse)
    { return xref->okToFillForm(ignoreOwnerPW); }
  GBool okToAccessibility(GBool ignoreOwnerPW = gFalse)
    { return xref->okToAccessibility(ignoreOwnerPW); }
  GBool okToAssemble(GBool ignoreOwnerPW = gFalse)
    { return xref->okToAssemble(ignoreOwnerPW); }

Kristian Høgsberg's avatar
Kristian Høgsberg committed
268 269

  // Is this document linearized?
270
  GBool isLinearized(GBool tryingToReconstruct = gFalse);
Kristian Høgsberg's avatar
Kristian Høgsberg committed
271 272

  // Return the document's Info dictionary (if any).
Albert Astals Cid's avatar
Albert Astals Cid committed
273 274
  Object getDocInfo() { return xref->getDocInfo(); }
  Object getDocInfoNF() { return xref->getDocInfoNF(); }
Kristian Høgsberg's avatar
Kristian Høgsberg committed
275

276 277
  // Create and return the document's Info dictionary if none exists.
  // Otherwise return the existing one.
Albert Astals Cid's avatar
Albert Astals Cid committed
278
  Object createDocInfoIfNoneExists() { return xref->createDocInfoIfNoneExists(); }
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312

  // Remove the document's Info dictionary and update the trailer dictionary.
  void removeDocInfo() { xref->removeDocInfo(); }

  // Set doc info string entry. NULL or empty value will cause a removal.
  // Takes ownership of value.
  void setDocInfoStringEntry(const char *key, GooString *value);

  // Set document's properties in document's Info dictionary.
  // NULL or empty value will cause a removal.
  // Takes ownership of value.
  void setDocInfoTitle(GooString *title) { setDocInfoStringEntry("Title", title); }
  void setDocInfoAuthor(GooString *author) { setDocInfoStringEntry("Author", author); }
  void setDocInfoSubject(GooString *subject) { setDocInfoStringEntry("Subject", subject); }
  void setDocInfoKeywords(GooString *keywords) { setDocInfoStringEntry("Keywords", keywords); }
  void setDocInfoCreator(GooString *creator) { setDocInfoStringEntry("Creator", creator); }
  void setDocInfoProducer(GooString *producer) { setDocInfoStringEntry("Producer", producer); }
  void setDocInfoCreatDate(GooString *creatDate) { setDocInfoStringEntry("CreationDate", creatDate); }
  void setDocInfoModDate(GooString *modDate) { setDocInfoStringEntry("ModDate", modDate); }

  // Get document's properties from document's Info dictionary.
  // Returns NULL on fail.
  // Returned GooStrings should be freed by the caller.
  GooString *getDocInfoStringEntry(const char *key);

  GooString *getDocInfoTitle() { return getDocInfoStringEntry("Title"); }
  GooString *getDocInfoAuthor() { return getDocInfoStringEntry("Author"); }
  GooString *getDocInfoSubject() { return getDocInfoStringEntry("Subject"); }
  GooString *getDocInfoKeywords() { return getDocInfoStringEntry("Keywords"); }
  GooString *getDocInfoCreator() { return getDocInfoStringEntry("Creator"); }
  GooString *getDocInfoProducer() { return getDocInfoStringEntry("Producer"); }
  GooString *getDocInfoCreatDate() { return getDocInfoStringEntry("CreationDate"); }
  GooString *getDocInfoModDate() { return getDocInfoStringEntry("ModDate"); }

313 314 315 316 317
  // Return the PDF subtype, part, and conformance
  PDFSubtype getPDFSubtype() const { return pdfSubtype; }
  PDFSubtypePart getPDFSubtypePart() const { return pdfPart; }
  PDFSubtypeConformance getPDFSubtypeConformance() const { return pdfConformance; }

Kristian Høgsberg's avatar
Kristian Høgsberg committed
318
  // Return the PDF version specified by the file.
319 320
  int getPDFMajorVersion() { return pdfMajorVersion; }
  int getPDFMinorVersion() { return pdfMinorVersion; }
Kristian Høgsberg's avatar
Kristian Høgsberg committed
321

322 323 324
  //Return the PDF ID in the trailer dictionary (if any).
  GBool getID(GooString *permanent_id, GooString *update_id);

325 326
  // Save one page with another name.
  int savePageAs(GooString *name, int pageNo);
Kristian Høgsberg's avatar
Kristian Høgsberg committed
327
  // Save this file with another name.
328
  int saveAs(GooString *name, PDFWriteMode mode=writeStandard);
329
  // Save this file in the given output stream.
330
  int saveAs(OutStream *outStr, PDFWriteMode mode=writeStandard);
331
  // Save this file with another name without saving changes
332
  int saveWithoutChangesAs(GooString *name);
333
  // Save this file in the given output stream without saving changes
334
  int saveWithoutChangesAs(OutStream *outStr);
Kristian Høgsberg's avatar
Kristian Høgsberg committed
335

336 337 338
  // Return a pointer to the GUI (XPDFCore or WinPDFCore object).
  void *getGUIData() { return guiData; }

339
  // rewrite pageDict with MediaBox, CropBox and new page CTM
340
  void replacePageDict(int pageNo, int rotate, PDFRectangle *mediaBox, PDFRectangle *cropBox);
341 342
  void markPageObjects(Dict *pageDict, XRef *xRef, XRef *countRef, Guint numOffset, int oldRefNum, int newRefNum, std::set<Dict*> *alreadyMarkedDicts = nullptr);
  GBool markAnnotations(Object *annots, XRef *xRef, XRef *countRef, Guint numOffset, int oldPageNum, int newPageNum, std::set<Dict*> *alreadyMarkedDicts = nullptr);
343
  void markAcroForm(Object *acrpForm, XRef *xRef, XRef *countRef, Guint numOffset, int oldPageNum, int newPageNum);
344
  // write all objects used by pageDict to outStr
Thomas Freitag's avatar
Thomas Freitag committed
345
  Guint writePageObjects(OutStream *outStr, XRef *xRef, Guint numOffset, GBool combine = gFalse);
346
  static void writeObject (Object *obj, OutStream* outStr, XRef *xref, Guint numOffset, Guchar *fileKey,
347
                           CryptAlgorithm encAlgorithm, int keyLength, int objNum, int objGen, std::set<Dict*> *alreadyWrittenDicts = nullptr);
348
  static void writeHeader(OutStream *outStr, int major, int minor);
349

350
  static Object createTrailerDict (int uxrefSize, GBool incrUpdate, Goffset startxRef,
Adrian Johnson's avatar
Adrian Johnson committed
351
                                  Ref *root, XRef *xRef, const char *fileName, Goffset fileSize);
352
  static void writeXRefTableTrailer (Object &&trailerDict, XRef *uxref, GBool writeAllEntries,
Adrian Johnson's avatar
Adrian Johnson committed
353
                                     Goffset uxrefOffset, OutStream* outStr, XRef *xRef);
354
  static void writeXRefStreamTrailer (Object &&trailerDict, XRef *uxref, Ref *uxrefStreamRef,
Adrian Johnson's avatar
Adrian Johnson committed
355
                                      Goffset uxrefOffset, OutStream* outStr, XRef *xRef);
356

Kristian Høgsberg's avatar
Kristian Høgsberg committed
357
private:
358
  // insert referenced objects in XRef
359 360
  void markDictionnary (Dict* dict, XRef *xRef, XRef *countRef, Guint numOffset, int oldRefNum, int newRefNum, std::set<Dict*> *alreadyMarkedDicts);
  void markObject (Object *obj, XRef *xRef, XRef *countRef, Guint numOffset, int oldRefNum, int newRefNum, std::set<Dict*> *alreadyMarkedDicts = nullptr);
361
  static void writeDictionnary (Dict* dict, OutStream* outStr, XRef *xRef, Guint numOffset, Guchar *fileKey,
362
                                CryptAlgorithm encAlgorithm, int keyLength, int objNum, int objGen, std::set<Dict*> *alreadyWrittenDicts);
363

364
  // Write object header to current file stream and return its offset
365
  static Goffset writeObjectHeader (Ref *ref, OutStream* outStr);
366 367
  static void writeObjectFooter (OutStream* outStr);

368
  void writeObject (Object *obj, OutStream* outStr, Guchar *fileKey, CryptAlgorithm encAlgorithm,
369 370
                    int keyLength, int objNum, int objGen, std::set<Dict*> *alreadyWrittenDicts = nullptr)
  { writeObject(obj, outStr, getXRef(), 0, fileKey, encAlgorithm, keyLength, objNum, objGen, alreadyWrittenDicts); }
371 372
  static void writeStream (Stream* str, OutStream* outStr);
  static void writeRawStream (Stream* str, OutStream* outStr);
373
  void writeXRefTableTrailer (Goffset uxrefOffset, XRef *uxref, GBool writeAllEntries,
Albert Astals Cid's avatar
Albert Astals Cid committed
374
                              int uxrefSize, OutStream* outStr, GBool incrUpdate);
375
  static void writeString (const GooString* s, OutStream* outStr, Guchar *fileKey,
376
                           CryptAlgorithm encAlgorithm, int keyLength, int objNum, int objGen);
377
  void saveIncrementalUpdate (OutStream* outStr);
Albert Astals Cid's avatar
Albert Astals Cid committed
378
  void saveCompleteRewrite (OutStream* outStr);
379

Hib Eris's avatar
Hib Eris committed
380 381 382 383 384
  Page *parsePage(int page);

  // Get hints.
  Hints *getHints();

Hib Eris's avatar
Hib Eris committed
385
  PDFDoc();
Hib Eris's avatar
Hib Eris committed
386
  void init();
Kristian Høgsberg's avatar
Kristian Høgsberg committed
387
  GBool setup(GooString *ownerPassword, GooString *userPassword);
388
  GBool checkFooter();
Kristian Høgsberg's avatar
Kristian Høgsberg committed
389
  void checkHeader();
390
  GBool checkEncryption(GooString *ownerPassword, GooString *userPassword);
391 392
  void extractPDFSubtype();

Hib Eris's avatar
Hib Eris committed
393
  // Get the offset of the start xref table.
394
  Goffset getStartXRef(GBool tryingToReconstruct = gFalse);
Hib Eris's avatar
Hib Eris committed
395 396
  // Get the offset of the entries in the main XRef table of a
  // linearized document (0 for non linearized documents).
397
  Goffset getMainXRefEntriesOffset(GBool tryingToReconstruct = gFalse);
Adrian Johnson's avatar
Adrian Johnson committed
398
  long long strToLongLong(char *s);
Kristian Høgsberg's avatar
Kristian Høgsberg committed
399

400 401 402
  // Mark the document's Info dictionary as modified.
  void setDocInfoModified(Object *infoObj);

Kristian Høgsberg's avatar
Kristian Høgsberg committed
403
  GooString *fileName;
404 405 406
#ifdef _WIN32
  wchar_t *fileNameU;
#endif
407
  GooFile *file;
Kristian Høgsberg's avatar
Kristian Høgsberg committed
408
  BaseStream *str;
409
  void *guiData;
410 411
  int pdfMajorVersion;
  int pdfMinorVersion;
412 413 414
  PDFSubtype pdfSubtype;
  PDFSubtypePart pdfPart;
  PDFSubtypeConformance pdfConformance;
Hib Eris's avatar
Hib Eris committed
415
  Linearization *linearization;
416 417 418 419
  // linearizationState = 0: unchecked
  // linearizationState = 1: checked and valid
  // linearizationState = 2: checked and invalid
  int linearizationState;
Kristian Høgsberg's avatar
Kristian Høgsberg committed
420
  XRef *xref;
Hib Eris's avatar
Hib Eris committed
421
  SecurityHandler *secHdlr;
Kristian Høgsberg's avatar
Kristian Høgsberg committed
422
  Catalog *catalog;
Hib Eris's avatar
Hib Eris committed
423
  Hints *hints;
Kristian Høgsberg's avatar
Kristian Høgsberg committed
424 425 426
#ifndef DISABLE_OUTLINE
  Outline *outline;
#endif
Hib Eris's avatar
Hib Eris committed
427
  Page **pageCache;
Kristian Høgsberg's avatar
Kristian Høgsberg committed
428 429 430

  GBool ok;
  int errCode;
431 432 433
  //If there is an error opening the PDF file with fopen() in the constructor, 
  //then the POSIX errno will be here.
  int fopenErrno;
Hib Eris's avatar
Hib Eris committed
434

Adrian Johnson's avatar
Adrian Johnson committed
435
  Goffset startXRefPos;		// offset of last xref table
436
  mutable std::recursive_mutex mutex;
Kristian Høgsberg's avatar
Kristian Høgsberg committed
437 438 439
};

#endif