PoDoFo 0.9.20
|
#include <PdfParser.h>
Public Member Functions | |
PdfParser (PdfIndirectObjectList &objects) | |
~PdfParser () | |
void | Parse (InputStreamDevice &device, bool loadOnDemand=true) |
bool | IsEncrypted () const |
void | SetPassword (const std::string_view &password) |
int | GetNumberOfIncrementalUpdates () const |
const PdfIndirectObjectList * | GetObjects () const |
PdfVersion | GetPdfVersion () const |
bool | GetLoadOnDemand () const |
size_t | GetFileSize () const |
const PdfEncrypt * | GetEncrypt () const |
bool | IsStrictParsing () const |
void | SetStrictParsing (bool strict) |
bool | GetIgnoreBrokenObjects () const |
void | SetIgnoreBrokenObjects (bool broken) |
PdfParser reads a PDF file into memory. The file can be modified in memory and written back using the PdfWriter class. Most PDF features are supported
PdfParser::PdfParser | ( | PdfIndirectObjectList & | objects | ) |
Create a new PdfParser object You have to open a PDF file using ParseFile later.
objects | vector to write the parsed PdfObjects to |
PdfParser::~PdfParser | ( | ) |
Delete the PdfParser and all PdfObjects
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Retrieve the number of incremental updates that have been applied to the last parsed PDF file.
0 means no update has been applied.
|
inline |
Get a reference to the sorted internal objects vector.
|
inline |
Get the file format version of the pdf
bool PdfParser::IsEncrypted | ( | ) | const |
|
inline |
void PdfParser::Parse | ( | InputStreamDevice & | device, |
bool | loadOnDemand = true ) |
Open a PDF file and parse it.
device | the input device to read from |
loadOnDemand | If true all objects will be read from the file at the time they are accessed first. If false all objects will be read immediately. This is faster if you do not need the complete PDF file in memory. |
This might throw a PdfError( PdfErrorCode::InvalidPassword ) exception if a password is required to read this PDF. Call SetPassword() with the correct password in this case.
|
inline |
Specify if the parser should ignore broken objects, i.e. XRef entries that do not point to valid objects.
Default is to ignore broken objects and to not throw an exception if one is found.
bBroken | if true broken objects will be ignored |
|
inline |
If you try to open an encrypted PDF file, which requires a password to open, PoDoFo will throw a PdfError( PdfErrorCode::InvalidPassword ) exception.
If you got such an exception, you have to set a password which should be used for opening the PDF.
The usual way will be to ask the user for the password and set the password using this method.
PdfParser will immediately continue to read the PDF file.
password | a user or owner password which can be used to open an encrypted PDF file If the password is invalid, a PdfError( PdfErrorCode::InvalidPassword ) exception is thrown! |
|
inline |
Enable/disable strict parsing mode. Strict parsing is by default disabled.
If you enable strict parsing, PoDoFo will fail on a few more common PDF failures. Please note that PoDoFo's parser is by default very strict already and does not recover from e.g. wrong XREF tables.
strict | new setting for strict parsing mode. |