pdfobjects::utils::IPdfWriter Class Reference

#include <pdfwriter.h>

Inheritance diagram for pdfobjects::utils::IPdfWriter:
observer::ObserverHandler< OperationStep > pdfobjects::utils::OldStylePdfWriter

List of all members.

Classes

struct  PrevSecInfo

Public Types

typedef std::pair< Ref, Object * > ObjectElement
typedef std::vector
< ObjectElement
ObjectList
typedef
observer::ScopedChangeContext
< OperationStep,
OperationScope
ChangeContext

Public Member Functions

virtual ~IPdfWriter ()
virtual void writeHeader (const char *version, StreamWriter &stream)
virtual void writeContent (const ObjectList &objectList, StreamWriter &stream, size_t off=0)=0
virtual size_t writeTrailer (const Object &trailer, const PrevSecInfo &prevSection, StreamWriter &stream, size_t off=0)=0
virtual void reset ()=0

Detailed Description

Interface for pdf content writer.

Implementator knows how to put data to the file to create correct pdf content.
Pdf content is written in 2 or 3 phases:

So each sequence of writeContent [, writeContent]* , writeTrailer forms new document revision. writeTrailer resets internal data and so it can be repeated.
Offset parameter can change default stream position. Default parameter value is 0, current position is used.

Class implements ObserverHandler with OperationStep value keeper and so Observers can be registered on each instance. Observer notification is in full control of implementator.

See also:
PdfWriterObserverContext
OperationScope
OperationStep

Member Typedef Documentation

Type for pdf writer observer contenxt.

This context holds OperationScope structure for change scope information. User of this context should get scope information by getScope method and its total field holds total number of operations that has to be perfomed. Observer gets also current operation number which is enough for progress information.

typedef std::pair<Ref, Object *> pdfobjects::utils::IPdfWriter::ObjectElement

Type for ObjectList element.

Type for object list. Each element is pair of object reference and its value.
In any case (or future changes) this type supports push_back method for storing and iterators which points to ObjectElement typed value.


Constructor & Destructor Documentation

virtual pdfobjects::utils::IPdfWriter::~IPdfWriter (  )  [inline, virtual]

Member Function Documentation

virtual void pdfobjects::utils::IPdfWriter::reset (  )  [pure virtual]

Resets internal data collected in writeContent method.

Everything collected in writeContent method, which is needed by writeTrailer for cross reference and trailer section generation, is cleared here.

Implemented in pdfobjects::utils::OldStylePdfWriter.

virtual void pdfobjects::utils::IPdfWriter::writeContent ( const ObjectList objectList,
StreamWriter stream,
size_t  off = 0 
) [pure virtual]

Puts all objects to given stream.

Parameters:
objectList List of objects to store.
stream Stream writer where to write.
off Stream offset where to start writing (if 0, uses current position).

Stores objects from the list and collects all information needed for writeTrailer method. Objects which should be marked as free should have objNull type. It is up to implementator how it handles free objects, but writing them as null object is also correct.
Doesn't write xref and trailer.

Implemented in pdfobjects::utils::OldStylePdfWriter.

Referenced by pdfobjects::XRefWriter::saveChanges(), and pdfobjects::utils::PdfDocumentWriter::writeDocument().

void pdfobjects::utils::IPdfWriter::writeHeader ( const char *  version,
StreamWriter stream 
) [virtual]

Writes PDF header to the given stream.

Parameters:
version Version of the PDF standard used for this document.
stream Stream writer where to write.

Moves the current position in the stream at the begginning before writing.

References PDFHEADER, and StreamWriter::putLine().

Referenced by pdfobjects::utils::PdfDocumentWriter::writeDocument().

virtual size_t pdfobjects::utils::IPdfWriter::writeTrailer ( const Object &  trailer,
const PrevSecInfo prevSection,
StreamWriter stream,
size_t  off = 0 
) [pure virtual]

Writes xref and trailer section.

Parameters:
trailer Trailer object.xrefPos.
prevSection Context for previous section.
stream Stream writer where to write.
off Stream offset where to start writing (if 0, uses current position).

Finishes pdf content writing by cross reference table and trailer dictionary. Uses internal data collected by writeContent method. reset method is called immediately after all data are written.

Returns:
stream position where it is safe to store data for new revision.

Implemented in pdfobjects::utils::OldStylePdfWriter.

Referenced by pdfobjects::XRefWriter::saveChanges(), and pdfobjects::utils::PdfDocumentWriter::writeDocument().


The documentation for this class was generated from the following files: