PoDoFo::PdfWriter Class Reference
#include <PdfWriter.h>
Inherited by PoDoFo::PdfImmediateWriter [private]
.
List of all members.
Detailed Description
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.
Constructor & Destructor Documentation
PoDoFo::PdfWriter::PdfWriter |
( |
PdfParser * |
pParser |
) |
|
PoDoFo::PdfWriter::PdfWriter |
( |
PdfDocument * |
pDocument |
) |
|
Create a new pdf file, based on an existing pdf file.
- Parameters:
-
Create a new pdf file, from an vector of PdfObjects and a trailer object.
- Parameters:
-
| pVecObjects | the vector of objects |
| pTrailer | a valid trailer object |
PoDoFo::PdfWriter::PdfWriter |
( |
PdfVecObjects * |
pVecObjects |
) |
[protected] |
Member Function Documentation
void PoDoFo::PdfWriter::CreateFileIdentifier |
( |
PdfString & |
identifier, |
|
|
const PdfObject * |
pTrailer | |
|
) |
| | const [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.
- Parameters:
-
| identifier | write the identifier to this string |
| pTrailer | trailer object |
void PoDoFo::PdfWriter::FillTrailerObject |
( |
PdfObject * |
pTrailer, |
|
|
pdf_long |
lSize, |
|
|
bool |
bPrevEntry, |
|
|
bool |
bOnlySizeKey | |
|
) |
| | const |
Add required keys to a trailer object
- Parameters:
-
| pTrailer | add keys to this object |
| lSize | number of objects in the PDF file |
| bPrevEntry | if true a prev entry is added to the trailer object with a value of 0 |
| bOnlySizeKey | write only the size key |
void PoDoFo::PdfWriter::GetByteOffset |
( |
PdfObject * |
pObject, |
|
|
pdf_long * |
pulOffset | |
|
) |
| | |
Calculate the byte offset of the object pObject in the PDF file if the file was written to disk at the moment of calling this function.
This function is very calculation intensive!
- Parameters:
-
| pObject | object to calculate the byte offset (has to be a child of this PdfWriter) |
| pulOffset | pointer to an unsigned long to save the offset |
bool PoDoFo::PdfWriter::GetEncrypted |
( |
|
) |
const [inline] |
- Returns:
- true if this PdfWriter creates an encrypted PDF file
bool PoDoFo::PdfWriter::GetLinearized |
( |
|
) |
const [inline] |
- Returns:
- true if this PDF file is web optimized.
EPdfVersion PoDoFo::PdfWriter::GetPdfVersion |
( |
|
) |
const [inline] |
Get the PDF version of the document
- Returns:
- EPdfVersion version of the pdf document
const char* PoDoFo::PdfWriter::GetPdfVersionString |
( |
|
) |
const [inline] |
Get the file format version of the pdf
- Returns:
- the file format version as string
bool PoDoFo::PdfWriter::GetUseXRefStream |
( |
|
) |
const [inline] |
- Returns:
- wether a XRef stream is used or not
void PoDoFo::PdfWriter::SetEncrypted |
( |
const PdfEncrypt & |
rEncrypt |
) |
|
Set the written document to be encrypted using a PdfEncrypt object
- Parameters:
-
| rEncrypt | an encryption object which is used to encrypt the written PDF file |
void PoDoFo::PdfWriter::SetLinearized |
( |
bool |
bLinearize |
) |
[inline] |
Enabled linearization for this document. I.e. optimize it for web usage. Default is false.
- Parameters:
-
| bLinearize | if true create a web optimized PDF file |
void PoDoFo::PdfWriter::SetPdfVersion |
( |
EPdfVersion |
eVersion |
) |
[inline] |
Set the PDF Version of the document. Has to be called before Write() to have an effect.
- Parameters:
-
| eVersion | version of the pdf document |
void PoDoFo::PdfWriter::SetUseXRefStream |
( |
bool |
bStream |
) |
[inline] |
Create a XRef stream which is in some case more compact but requires at least PDF 1.5 Default is false.
- Parameters:
-
| bStream | if true a XRef stream object will be created |
Writes the complete document to a PdfOutputDevice
- Parameters:
-
| pDevice | write to the specified device |
void PoDoFo::PdfWriter::Write |
( |
const char * |
pszFilename |
) |
|
Writes the complete document to a PDF file.
- Parameters:
-
| pszFilename | filename of a PDF file. |
void PoDoFo::PdfWriter::WritePdfHeader |
( |
PdfOutputDevice * |
pDevice |
) |
[protected] |
Writes the pdf header to the current file.
- Parameters:
-
| pDevice | write to this output device |
Write pdf objects to file
- Parameters:
-
| pDevice | write to this output device |
| vecObjects | write all objects in this vector to the file |
| pXref | add all written objects to this XRefTable |
void PoDoFo::PdfWriter::WriteToBuffer |
( |
char ** |
ppBuffer, |
|
|
pdf_long * |
pulLen | |
|
) |
| | |
Write the whole document to a buffer in memory.
Better use a PdfOutputDevice that writes to a PdfRefCountedBuffer.
- Parameters:
-
| ppBuffer | will be malloc'ed and the document will be written to this buffer. |
| pulLen | the length of the buffer will be returned in this parameter |
- Returns:
- ErrOk on success
- See also:
- Write
Member Data Documentation
Fill all keys in the linearization dictionary with their values
- Parameters:
-
| pLinearize | a linearization dictionary |
| pHint | the hint stream |
| pPage | the first page in the linerarized PDF file |
| pLast | pointer of the last object belonging to the first page |
| pVecXRefOffset | xref table entries for previous entry |