PoDoFo 0.9.1
Public Member Functions
PoDoFo::PdfOutputDevice Class Reference

#include <PdfOutputDevice.h>

Inheritance diagram for PoDoFo::PdfOutputDevice:
PoDoFo::PdfSignOutputDevice

List of all members.

Public Member Functions

 PdfOutputDevice ()
 PdfOutputDevice (const char *pszFilename)
 PdfOutputDevice (char *pBuffer, size_t lLen)
 PdfOutputDevice (const std::ostream *pOutStream)
 PdfOutputDevice (PdfRefCountedBuffer *pOutBuffer)
virtual ~PdfOutputDevice ()
virtual size_t GetLength () const
virtual void Print (const char *pszFormat,...)
virtual void PrintV (const char *pszFormat, long lBytes, va_list argptr)
long PrintVLen (const char *pszFormat, va_list args)
virtual void Write (const char *pBuffer, size_t lLen)
virtual size_t Read (char *pBuffer, size_t lLen)
virtual void Seek (size_t offset)
virtual size_t Tell () const
virtual void Flush ()

Detailed Description

This class provides an output device which operates either on a file or on a buffer in memory. Additionally it can count the bytes written to the device.

This class is suitable for inheritance to provide output devices of your own for PoDoFo. Just overide the required virtual methods.


Constructor & Destructor Documentation

PoDoFo::PdfOutputDevice::PdfOutputDevice ( )

Construct a new PdfOutputDevice that does not write any data. Only the length of the data is counted.

PoDoFo::PdfOutputDevice::PdfOutputDevice ( const char *  pszFilename)

Construct a new PdfOutputDevice that writes all data to a file.

Parameters:
pszFilenamepath to a file that will be opened and all data is written to this file.
PoDoFo::PdfOutputDevice::PdfOutputDevice ( char *  pBuffer,
size_t  lLen 
)

Construct a new PdfOutputDevice that writes all data to a memory buffer. The buffer will not be owned by this object and has to be allocated before.

Parameters:
pBuffera buffer in memory
lLenthe length of the buffer in memory
PoDoFo::PdfOutputDevice::PdfOutputDevice ( const std::ostream *  pOutStream)

Construct a new PdfOutputDevice that writes all data to a std::ostream.

WARNING: PoDoFo will change the stream's locale. It will be restored when the PdfOutputStream controlling the stream is destroyed.

Parameters:
pOutStreamwrite to this std::ostream
PoDoFo::PdfOutputDevice::PdfOutputDevice ( PdfRefCountedBuffer pOutBuffer)

Construct a new PdfOutputDevice that writes all data to a PdfRefCountedBuffer. This output device has the advantage that the PdfRefCountedBuffer will resize itself if more memory is needed to hold all data.

Parameters:
pOutBufferwrite to this PdfRefCountedBuffer
See also:
PdfRefCountedBuffer
PoDoFo::PdfOutputDevice::~PdfOutputDevice ( ) [virtual]

Destruct the PdfOutputDevice object and close any open files.


Member Function Documentation

void PoDoFo::PdfOutputDevice::Flush ( ) [virtual]

Flush the output files buffer to disk if this devices operates on a disk.

Reimplemented in PoDoFo::PdfSignOutputDevice.

size_t PoDoFo::PdfOutputDevice::GetLength ( ) const [inline, virtual]

The number of bytes written to this object.

Returns:
the number of bytes written to this object.
See also:
Init

Reimplemented in PoDoFo::PdfSignOutputDevice.

void PoDoFo::PdfOutputDevice::Print ( const char *  pszFormat,
  ... 
) [virtual]

Write to the PdfOutputDevice. Usage is as the usage of printf.

WARNING: Do not use this for doubles or floating point values as the output might depend on the current locale.

Parameters:
pszFormata format string as you would use it with printf
Returns:
ErrOk on success
See also:
Write

Reimplemented in PoDoFo::PdfSignOutputDevice.

void PoDoFo::PdfOutputDevice::PrintV ( const char *  pszFormat,
long  lBytes,
va_list  argptr 
) [virtual]

Write to the PdfOutputDevice. Usage is as the usage of printf.

WARNING: Do not use this for doubles or floating point values as the output might depend on the current locale.

Parameters:
pszFormata format string as you would use it with printf
lByteslength of the format string in bytes when written
argptrvariable argument list
Returns:
ErrOk on success
See also:
Write
long PoDoFo::PdfOutputDevice::PrintVLen ( const char *  pszFormat,
va_list  args 
)

Determine the length of a format string in bytes when written using PrintV

Parameters:
pszFormatformat string
argsvariable argument list
Returns:
length in bytes
See also:
PrintV
size_t PoDoFo::PdfOutputDevice::Read ( char *  pBuffer,
size_t  lLen 
) [virtual]

Read data from the device

Parameters:
pBuffera pointer to the data buffer
lLenlength of the output buffer
Returns:
Number of read bytes. Return 0 if EOF

Reimplemented in PoDoFo::PdfSignOutputDevice.

void PoDoFo::PdfOutputDevice::Seek ( size_t  offset) [virtual]

Seek the device to the position offset from the begining

Parameters:
offsetfrom the beginning of the file

Reimplemented in PoDoFo::PdfSignOutputDevice.

size_t PoDoFo::PdfOutputDevice::Tell ( ) const [inline, virtual]

Get the current offset from the beginning of the file.

Returns:
the offset form the beginning of the file.

Reimplemented in PoDoFo::PdfSignOutputDevice.

void PoDoFo::PdfOutputDevice::Write ( const char *  pBuffer,
size_t  lLen 
) [virtual]

Write data to the buffer. Use this call instead of Print if you want to write binary data to the PdfOutputDevice.

Parameters:
pBuffera pointer to the data buffer
lLenwrite lLen bytes of pBuffer to the PdfOutputDevice
Returns:
ErrOk on success
See also:
Print

Reimplemented in PoDoFo::PdfSignOutputDevice.