|
pdfmm 0.9.20
|
#include <PdfContentsTokenizer.h>
Public Member Functions | |
| PdfContentsTokenizer (const std::shared_ptr< PdfInputDevice > &device) | |
| PdfContentsTokenizer (PdfCanvas &canvas) | |
| bool | TryReadNext (PdfContentsType &contentsType, std::string_view &keyword, PdfVariant &variant) |
This class is a parser for content streams in PDF documents.
The parsed content stream can be used and modified in various ways.
This class is currently work in progress and subject to change!
| PdfContentsTokenizer::PdfContentsTokenizer | ( | const std::shared_ptr< PdfInputDevice > & | device | ) |
Construct a PdfContentsTokenizer from an existing device
| PdfContentsTokenizer::PdfContentsTokenizer | ( | PdfCanvas & | canvas | ) |
Construct a PdfContentsTokenizer from a PdfCanvas (i.e. PdfPage or a PdfXObject).
This is more convenient as you do not have to care about buffers yourself.
| canvas | an object that hold a PDF contents stream |
| bool PdfContentsTokenizer::TryReadNext | ( | PdfContentsType & | contentsType, |
| std::string_view & | keyword, | ||
| PdfVariant & | variant | ||
| ) |
Read the next keyword or variant, returning true and setting reType if something was read. Either keyword or variant, but never both, have defined and usable values on true return, with which being controlled by the value of contentsType.
If EOF is encountered, returns false and leaves contentsType, keyword and variant undefined.
As a special case, reType may be set to PdfContentsType::ImageData. In this case keyword is undefined, and variant contains a PdfData variant containing the byte sequence between the ID and BI keywords sans the one byte of leading- and trailing- white space. No filter decoding is performed.
| [out] | contentsType | will be set to either keyword or variant if true is returned. Undefined if false is returned. |
| [out] | keyword | if pType is set to PdfContentsType::Keyword this will point to the keyword, otherwise the value is undefined. If set, the value points to memory owned by the PdfContentsTokenizer and must not be freed. The value is invalidated when TryReadNext is next called or when the PdfContentsTokenizer is destroyed. |
| [out] | variant | if pType is set to PdfContentsType::Variant or PdfContentsType::ImageData this will be set to the read variant, otherwise the value is undefined. |