PoDoFo 0.9.20
PoDoFo::PdfXRefStream Class Reference

#include <PdfXRefStream.h>

Inheritance diagram for PoDoFo::PdfXRefStream:
PoDoFo::PdfXRef

Public Member Functions

 PdfXRefStream (PdfWriter &writer)
 
uint64_t GetOffset () const override
 
bool ShouldSkipWrite (const PdfReference &ref) override
 
- Public Member Functions inherited from PoDoFo::PdfXRef
void AddInUseObject (const PdfReference &ref, nullable< uint64_t > offset)
 
void AddFreeObject (const PdfReference &ref)
 
void Write (OutputStreamDevice &device, charbuff &buffer)
 
uint32_t GetSize () const
 
void SetFirstEmptyBlock ()
 

Protected Member Functions

void BeginWrite (OutputStreamDevice &device, charbuff &buffer) override
 
void WriteSubSection (OutputStreamDevice &device, uint32_t first, uint32_t count, charbuff &buffer) override
 
void WriteXRefEntry (OutputStreamDevice &device, const PdfReference &ref, const PdfXRefEntry &entry, charbuff &buffer) override
 
void EndWriteImpl (OutputStreamDevice &device, charbuff &buffer) override
 

Detailed Description

Creates an XRef table that is a stream object. Requires at least PDF 1.5. XRef streams are more compact than normal XRef tables.

This is an internal class of PoDoFo used by PdfWriter.

Constructor & Destructor Documentation

◆ PdfXRefStream()

PdfXRefStream::PdfXRefStream ( PdfWriter & writer)

Create a new XRef table

Parameters
writeris needed to fill the trailer directory correctly which is included into the XRef
parenta vector of PdfObject is required to create a PdfObject for the XRef

Member Function Documentation

◆ BeginWrite()

void PdfXRefStream::BeginWrite ( OutputStreamDevice & device,
charbuff & buffer )
overrideprotectedvirtual

Called at the start of writing the XRef table. This method can be overwritten in subclasses to write a general header for the XRef table.

Parameters
devicethe output device to which the XRef table should be written.

Reimplemented from PoDoFo::PdfXRef.

◆ EndWriteImpl()

void PdfXRefStream::EndWriteImpl ( OutputStreamDevice & device,
charbuff & buffer )
overrideprotectedvirtual

Sub classes can overload this method to finish a XRef table.

Parameters
devicethe output device to which the XRef table should be written.

Reimplemented from PoDoFo::PdfXRef.

◆ GetOffset()

uint64_t PdfXRefStream::GetOffset ( ) const
overridevirtual
Returns
the offset in the file at which the XRef table starts after it was written

Reimplemented from PoDoFo::PdfXRef.

◆ ShouldSkipWrite()

bool PdfXRefStream::ShouldSkipWrite ( const PdfReference & ref)
overridevirtual

Should skip writing for this object

Parameters
refreference of the object

Reimplemented from PoDoFo::PdfXRef.

◆ WriteSubSection()

void PdfXRefStream::WriteSubSection ( OutputStreamDevice & device,
uint32_t first,
uint32_t count,
charbuff & buffer )
overrideprotectedvirtual

Begin an XRef subsection. All following calls of WriteXRefEntry belong to this XRef subsection.

Parameters
devicethe output device to which the XRef table should be written.
firstthe object number of the first object in this subsection
countthe number of entries in this subsection

Reimplemented from PoDoFo::PdfXRef.

◆ WriteXRefEntry()

void PdfXRefStream::WriteXRefEntry ( OutputStreamDevice & device,
const PdfReference & ref,
const PdfXRefEntry & entry,
charbuff & buffer )
overrideprotectedvirtual

Write a single entry to the XRef table

Parameters
devicethe output device to which the XRef table should be written.
refthe reference of object of the entry
entrythe XRefEntry of this object

Reimplemented from PoDoFo::PdfXRef.