#include <PdfParserObject.h>
A PdfParserObject constructs a PdfObject from a PDF file. Parsing starts always at the current file position.
◆ PdfParserObject() [1/2]
| mm::PdfParserObject::PdfParserObject |
( |
PdfDocument & |
document, |
|
|
const std::shared_ptr< PdfInputDevice > & |
device, |
|
|
ssize_t |
offset = -1 |
|
) |
| |
Parse the object data from the given file handle starting at the current position.
- Parameters
-
| document | document where to resolve object references |
| device | an open reference counted input device which is positioned in front of the object which is going to be parsed. |
| buffer | buffer to use for parsing to avoid reallocations |
| offset | the position in the device from which the object shall be read if lOffset = -1, the object will be read from the current position in the file. |
◆ PdfParserObject() [2/2]
| PdfParserObject::PdfParserObject |
( |
| ) |
|
Parse the object data for an internal object. You have to call ParseDictionaryKeys as next function call.
The following two parameters are used to avoid allocation of a new buffer in PdfSimpleParser.
- Warning
- This constructor is for internal usage only!
◆ DelayedLoadImpl()
| void PdfParserObject::DelayedLoadImpl |
( |
| ) |
|
|
overrideprotectedvirtual |
Load all data of the object if delayed loading is enabled.
Never call this method directly; use DelayedLoad() instead.
You should override this to control deferred loading in your subclass. Note that this method should not load any associated streams, just the base object.
The default implementation throws. It should never be called, since objects that do not support delayed loading should not enable it.
While this method is not ‘const’ it may be called from a const context, so be careful what you mess with.
Reimplemented from mm::PdfObject.
◆ FreeObjectMemory()
| void PdfParserObject::FreeObjectMemory |
( |
bool |
force = false | ) |
|
Tries to free all memory allocated by this PdfObject (variables and streams) and reads it from disk again if it is requested another time.
This will only work if load on demand is used. If the object is dirty if will not be free'd.
- Parameters
-
| force | if true the object will be free'd even if IsDirty() returns true. So you will loose any changes made to this object. |
- See also
- IsLoadOnDemand
-
IsDirty
◆ GetOffset()
| ssize_t mm::PdfParserObject::GetOffset |
( |
| ) |
const |
|
inline |
Gets an offset in which the object beginning is stored in the file. Note the offset points just after the object identificator ("0 0 obj").
- Returns
- an offset in which the object is stored in the source device, or -1, if the object was created on demand.
◆ HasStreamToParse()
| bool mm::PdfParserObject::HasStreamToParse |
( |
| ) |
const |
|
inline |
Returns if this object has a stream object appended. which has to be parsed.
- Returns
- true if there is a stream
◆ IsLoadOnDemand()
| bool mm::PdfParserObject::IsLoadOnDemand |
( |
| ) |
const |
|
inline |
- Returns
- true if this PdfParser loads all objects at the time they are accessed for the first time. The default is to load all object immediately. In this case false is returned.
◆ ParseFile()
| void PdfParserObject::ParseFile |
( |
PdfEncrypt * |
encrypt, |
|
|
bool |
isTrailer = false |
|
) |
| |
Parse the object data from the given file handle If delayed loading is enabled, only the object and generation number is read now and everything else is read later.
- Parameters
-
| encrypt | an encryption dictionary which is used to decrypt strings and streams during parsing or nullptr if the PDF file was not encrypted |
| isTrailer | whether this is a trailer dictionary or not. trailer dictionaries do not have a object number etc. |
◆ SetLoadOnDemand()
| void mm::PdfParserObject::SetLoadOnDemand |
( |
bool |
bDelayed | ) |
|
|
inline |
Sets whether this object shall be loaded on demand when it's data is accessed for the first time.
- Parameters
-
| bDelayed | if true the object is loaded delayed. |