PoDoFo 0.9.20
|
#include <PdfWriter.h>
Public Member Functions | |
PdfWriter (PdfIndirectObjectList &objects, const PdfObject &trailer) | |
void | Write (OutputStreamDevice &device) |
void | SetUseXRefStream (bool useXRefStream) |
void | SetEncrypt (const PdfEncrypt &encrypt) |
void | FillTrailerObject (PdfObject &trailer, size_t size, bool onlySizeKey) const |
PdfWriteFlags | GetWriteFlags () const |
void | SetPdfVersion (PdfVersion version) |
PdfVersion | GetPdfVersion () const |
bool | GetUseXRefStream () const |
void | SetPrevXRefOffset (int64_t prevXRefOffset) |
int64_t | GetPrevXRefOffset () const |
void | SetIncrementalUpdate (bool rewriteXRefTable) |
bool | GetIncrementalUpdate () const |
bool | GetEncrypted () const |
Protected Member Functions | |
PdfWriter (PdfIndirectObjectList &objects) | |
void | WritePdfHeader (OutputStreamDevice &device) |
void | WritePdfObjects (OutputStreamDevice &device, const PdfIndirectObjectList &objects, PdfXRef &xref) |
void | CreateFileIdentifier (PdfString &identifier, const PdfObject &trailer, PdfString *originalIdentifier=nullptr) |
The PdfWriter class writes a list of PdfObjects as PDF file. The XRef section (which is the required table of contents for any PDF file) is created automatically.
It does not know about pages but only about PdfObjects.
Most users will want to use PdfDocument.
PdfWriter::PdfWriter | ( | PdfIndirectObjectList & | objects, |
const PdfObject & | trailer ) |
Create a new pdf file, from an vector of PdfObjects and a trailer object.
objects | the vector of objects |
trailer | a valid trailer object |
|
protected |
Create a PdfWriter from a PdfIndirectObjectList
|
protected |
Creates a file identifier which is required in several PDF workflows. All values from the files document information dictionary are used to create a unique MD5 key which is added to the trailer dictionary.
identifier | write the identifier to this string |
trailer | trailer object |
pOriginalIdentifier | write the original identifier (when using incremental update) to this string |
void PdfWriter::FillTrailerObject | ( | PdfObject & | trailer, |
size_t | size, | ||
bool | onlySizeKey ) const |
Add required keys to a trailer object
trailer | add keys to this object |
size | number of objects in the PDF file |
onlySizeKey | write only the size key |
|
inline |
|
inline |
|
inline |
Get the PDF version of the document
|
inline |
|
inline |
|
inline |
Get the write mode used for writing the PDF
void PdfWriter::SetEncrypt | ( | const PdfEncrypt & | encrypt | ) |
Set the written document to be encrypted using a PdfEncrypt object
encrypt | an encryption object which is used to encrypt the written PDF file |
void PdfWriter::SetIncrementalUpdate | ( | bool | rewriteXRefTable | ) |
Set whether writing an incremental update. Default is false.
incrementalUpdate | if true an incremental update will be written |
|
inline |
Set the PDF Version of the document. Has to be called before Write() to have an effect.
version | version of the pdf document |
|
inline |
Sets an offset to the previous XRef table. Set it to lower than or equal to 0, to not write a reference to the previous XRef table. The default is 0.
lPrevXRefOffset | the previous XRef table offset |
void PdfWriter::SetUseXRefStream | ( | bool | useXRefStream | ) |
Create a XRef stream which is in some case more compact but requires at least PDF 1.5 Default is false.
useXRefStream | if true a XRef stream object will be created |
void PdfWriter::Write | ( | OutputStreamDevice & | device | ) |
Internal implementation of the Write() call with the common code
device | write to this output device |
bRewriteXRefTable | whether will rewrite whole XRef table (used only if GetIncrementalUpdate() returns true) |
|
protected |
Writes the pdf header to the current file.
device | write to this output device |
|
protected |
Write pdf objects to file
device | write to this output device |
objects | write all objects in this vector to the file |
pXref | add all written objects to this XRefTable |
bRewriteXRefTable | whether will rewrite whole XRef table (used only if GetIncrementalUpdate() returns true) |