#include <PdfParser.h>
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()
Create a new PdfParser object You have to open a PDF file using ParseFile later.
- Parameters
-
| objects | vector to write the parsed PdfObjects to |
- See also
- ParseFile
◆ ~PdfParser()
| PdfParser::~PdfParser |
( |
| ) |
|
◆ GetEncrypt()
| const PdfEncrypt * PoDoFo::PdfParser::GetEncrypt |
( |
| ) |
const |
|
inline |
- Returns
- the parsers encryption object or nullptr if the read PDF file was not encrypted
◆ GetFileSize()
| size_t PoDoFo::PdfParser::GetFileSize |
( |
| ) |
const |
|
inline |
- Returns
- the length of the file
◆ GetIgnoreBrokenObjects()
| bool PoDoFo::PdfParser::GetIgnoreBrokenObjects |
( |
| ) |
const |
|
inline |
- Returns
- if broken objects are ignored while parsing
◆ GetLoadOnDemand()
| bool PoDoFo::PdfParser::GetLoadOnDemand |
( |
| ) |
const |
|
inline |
- Returns
- true if this PdfParser loads all objects on demand at the time they are accessed first. The default is to load all object immediately. In this case false is returned.
◆ GetNumberOfIncrementalUpdates()
| int PoDoFo::PdfParser::GetNumberOfIncrementalUpdates |
( |
| ) |
const |
|
inline |
Retrieve the number of incremental updates that have been applied to the last parsed PDF file.
0 means no update has been applied.
- Returns
- the number of incremental updates to the parsed PDF.
◆ GetObjects()
Get a reference to the sorted internal objects vector.
- Returns
- the internal objects vector.
◆ GetPdfVersion()
| PdfVersion PoDoFo::PdfParser::GetPdfVersion |
( |
| ) |
const |
|
inline |
Get the file format version of the pdf
- Returns
- the file format version as enum
◆ IsEncrypted()
| bool PdfParser::IsEncrypted |
( |
| ) |
const |
- Returns
- true if this PdfWriter creates an encrypted PDF file
◆ IsStrictParsing()
| bool PoDoFo::PdfParser::IsStrictParsing |
( |
| ) |
const |
|
inline |
- Returns
- true if strict parsing mode is enabled
- See also
- SetStringParsing
◆ Parse()
Open a PDF file and parse it.
- Parameters
-
| 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.
- See also
- SetPassword
◆ SetIgnoreBrokenObjects()
| void PoDoFo::PdfParser::SetIgnoreBrokenObjects |
( |
bool | broken | ) |
|
|
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.
- Parameters
-
| bBroken | if true broken objects will be ignored |
◆ SetPassword()
| void PoDoFo::PdfParser::SetPassword |
( |
const std::string_view & | password | ) |
|
|
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.
- Parameters
-
| 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! |
◆ SetStrictParsing()
| void PoDoFo::PdfParser::SetStrictParsing |
( |
bool | strict | ) |
|
|
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.
- Parameters
-
| strict | new setting for strict parsing mode. |
The documentation for this class was generated from the following files:
- PdfParser.h
- PdfParser.cpp