CIB pdf toolbox 2 technical documentation

4. Usecases

4.7. Writing PDF documents

Writing a document to a file

Property

Meaning

Type

OutputFilename

Filename to which the pdf should be written to.

Set

 

Writing a document to memory

Property

Meaning

Type

MemoryOutputCallback

Address of a callback function which retrieves the pdf data. The address has to be written as a string, which contains the address as normal number. The callback function needs to have the signature:

int MemoryCallback(const uint8_t* output, size_t length, void* userdata, int error);

  • output contains some data of the pdf file to write.
  • length defines the length of the data
  • userdata is the object, defined inside MemoryOutputUserdata
  • error defines, if there was an error during execution, otherwise 0.

The return value needs to be 1, if the callback wan’t to return success, otherwise 0.

Set

MemoryOutputUserdata

Address of a userdata object which is used inside the callback. The address has to be written as a string, which contains the address as normal number.

 

 

Normally a PDF is saved with the best saving options, which the PdfVersion of the document allows. This means object stream and xref streams will be used with a PdfVersion greater or equal to 1.5. This behavior can be overridden by setting the property WritingMode:

Property

Meaning

Type

DontOverwriteProducer

Don’t write the CIB pdfModule default Producer into the Metadata.

Set

WritingMode

  • ObjectAndXrefStream: use object and xref streams
  • XrefStream: use only xref streams
  • Xref: use only standard xref
  • Best: use the best algorithm for the used PDF version (default)

Set

IncrementalUpdate

  • 0: Deactivated (default)
  • 1: Activated always
  • Auto: Activated only, when signed Signature fields already exits in the PDF document

An incremental update to a PDF means, that the whole input document is not changed in its content, but at the end of the document all changes, which were made are written combined inside an update entry. This means e.g. that signed signatures in an existing PDF document are not getting broken, but still you can add more content or modify the PDF document. Inside a (good) PDF viewer you can see then, that the PDF consists of different versions and you can switch between them.

Set