#include <PdfMemDocument.h>
|
| | PdfMemDocument () |
| |
| | PdfMemDocument (const PdfMemDocument &rhs) |
| |
| void | Load (const std::string_view &filename, const std::string_view &password={ }) |
| |
| void | LoadFromBuffer (const bufferview &buffer, const std::string_view &password={ }) |
| |
| void | LoadFromDevice (const std::shared_ptr< InputStreamDevice > &device, const std::string_view &password={ }) |
| |
| void | Save (const std::string_view &filename, PdfSaveOptions opts=PdfSaveOptions::None) |
| |
| void | Save (OutputStreamDevice &device, PdfSaveOptions opts=PdfSaveOptions::None) |
| |
| void | SaveUpdate (const std::string_view &filename, PdfSaveOptions opts=PdfSaveOptions::None) |
| |
| void | SaveUpdate (OutputStreamDevice &device, PdfSaveOptions opts=PdfSaveOptions::None) |
| |
| void | AddPdfExtension (const PdfName &ns, int64_t level) |
| |
| bool | HasPdfExtension (const PdfName &ns, int64_t level) const |
| |
| void | RemovePdfExtension (const PdfName &ns, int64_t level) |
| |
| std::vector< PdfExtension > | GetPdfExtensions () const |
| |
| void | SetEncrypted (const std::string_view &userPassword, const std::string_view &ownerPassword, PdfPermissions protection=PdfPermissions::Default, PdfEncryptAlgorithm algorithm=PdfEncryptAlgorithm::AESV2, PdfKeyLength keyLength=PdfKeyLength::L40) |
| |
| void | SetEncrypt (std::unique_ptr< PdfEncrypt > &&encrypt) |
| |
| void | FreeObjectMemory (const PdfReference &ref, bool force=false) |
| |
| void | FreeObjectMemory (PdfObject *obj, bool force=false) |
| |
| virtual | ~PdfDocument () |
| |
| PdfOutlines & | GetOrCreateOutlines () |
| |
| PdfNameTree & | GetOrCreateNameTree () |
| |
| PdfAcroForm & | GetOrCreateAcroForm (PdfAcroFormDefaulAppearance eDefaultAppearance=PdfAcroFormDefaulAppearance::BlackText12pt) |
| |
| void | AttachFile (const PdfFileSpec &fileSpec) |
| |
| PdfFileSpec * | GetAttachment (const PdfString &name) |
| |
| void | AddNamedDestination (const PdfDestination &dest, const PdfString &name) |
| |
| std::unique_ptr< PdfImage > | CreateImage (const std::string_view &prefix={ }) |
| |
| bool | IsPrintAllowed () const |
| |
| bool | IsEditAllowed () const |
| |
| bool | IsCopyAllowed () const |
| |
| bool | IsEditNotesAllowed () const |
| |
| bool | IsFillAndSignAllowed () const |
| |
| bool | IsAccessibilityAllowed () const |
| |
| bool | IsDocAssemblyAllowed () const |
| |
| bool | IsHighPrintAllowed () const |
| |
| bool | IsEncrypted () const |
| |
| PdfCatalog & | GetCatalog () |
| |
| const PdfCatalog & | GetCatalog () const |
| |
| PdfPageCollection & | GetPages () |
| |
| const PdfPageCollection & | GetPages () const |
| |
| PdfTrailer & | GetTrailer () |
| |
| const PdfTrailer & | GetTrailer () const |
| |
| const PdfInfo * | GetInfo () const |
| |
| PdfIndirectObjectList & | GetObjects () |
| |
| const PdfIndirectObjectList & | GetObjects () const |
| |
PdfMemDocument is the core class for reading and manipulating PDF files and writing them back to disk.
PdfMemDocument was designed to allow easy access to the object structur of a PDF file.
PdfMemDocument should be used whenever you want to change the object structure of a PDF file.
When you are only creating PDF files, please use PdfStreamedDocument which is usually faster for creating PDFs.
- See also
- PdfDocument
-
PdfStreamedDocument
-
PdfParser
-
PdfWriter
◆ PdfMemDocument() [1/2]
| PdfMemDocument::PdfMemDocument |
( |
| ) |
|
◆ PdfMemDocument() [2/2]
Construct a copy of the given document
◆ AddPdfExtension()
| void PdfMemDocument::AddPdfExtension |
( |
const PdfName & | ns, |
|
|
int64_t | level ) |
Add a vendor-specific extension to the current PDF version.
- Parameters
-
| ns | namespace of the extension |
| level | level of the extension |
◆ FreeObjectMemory() [1/2]
| void PdfMemDocument::FreeObjectMemory |
( |
const PdfReference & | ref, |
|
|
bool | force = false ) |
Tries to free all memory allocated by the given 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. Other- wise any call to this method will be ignored. Load on demand is currently always enabled when using PdfMemDocument. If the object is dirty if will not be free'd.
- Parameters
-
| ref | free all memory allocated by the object with this reference. |
| force | if true the object will be free'd even if IsDirty() returns true. So you will loose any changes made to this object. |
This is an overloaded member for your convenience.
◆ FreeObjectMemory() [2/2]
| void PdfMemDocument::FreeObjectMemory |
( |
PdfObject * | obj, |
|
|
bool | force = false ) |
Tries to free all memory allocated by the given 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. Other- wise any call to this method will be ignored. Load on demand is currently always enabled when using PdfMemDocument. If the object is dirty if will not be free'd.
- Parameters
-
| obj | free object from memory |
| 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
- IsDirty
◆ GetPdfExtensions()
| vector< PdfExtension > PdfMemDocument::GetPdfExtensions |
( |
| ) |
const |
Return the list of all vendor-specific extensions to the current PDF version.
- Parameters
-
| ns | namespace of the extension |
| level | level of the extension |
◆ GetPdfVersion()
| PdfVersion PdfMemDocument::GetPdfVersion |
( |
| ) |
const |
|
overrideprotectedvirtual |
◆ HasPdfExtension()
| bool PdfMemDocument::HasPdfExtension |
( |
const PdfName & | ns, |
|
|
int64_t | level ) const |
Checks whether the documents is tagged to imlpement a vendor-specific extension to the current PDF version.
- Parameters
-
| ns | namespace of the extension |
| level | level of the extension |
◆ Load()
| void PdfMemDocument::Load |
( |
const std::string_view & | filename, |
|
|
const std::string_view & | password = { } ) |
Load a PdfMemDocument from a file
- Parameters
-
| filename | filename of the file which is going to be parsed/opened |
When the bForUpdate is set to true, the filename is copied for later use by WriteUpdate.
- See also
- WriteUpdate, LoadFromBuffer, LoadFromDevice
◆ LoadFromBuffer()
| void PdfMemDocument::LoadFromBuffer |
( |
const bufferview & | buffer, |
|
|
const std::string_view & | password = { } ) |
◆ LoadFromDevice()
| void PdfMemDocument::LoadFromDevice |
( |
const std::shared_ptr< InputStreamDevice > & | device, |
|
|
const std::string_view & | password = { } ) |
◆ RemovePdfExtension()
| void PdfMemDocument::RemovePdfExtension |
( |
const PdfName & | ns, |
|
|
int64_t | level ) |
Remove a vendor-specific extension to the current PDF version.
- Parameters
-
| ns | namespace of the extension |
| level | level of the extension |
◆ Save() [1/2]
| void PoDoFo::PdfMemDocument::Save |
( |
const std::string_view & | filename, |
|
|
PdfSaveOptions | opts = PdfSaveOptions::None ) |
Save the complete document to a file
- Parameters
-
| filename | filename of the document |
- See also
- Save, SaveUpdate
This is an overloaded member function for your convenience.
◆ Save() [2/2]
| void PdfMemDocument::Save |
( |
OutputStreamDevice & | device, |
|
|
PdfSaveOptions | opts = PdfSaveOptions::None ) |
Save the complete document to an output device
- Parameters
-
| device | write to this output device |
- See also
- SaveUpdate
◆ SaveUpdate() [1/2]
| void PoDoFo::PdfMemDocument::SaveUpdate |
( |
const std::string_view & | filename, |
|
|
PdfSaveOptions | opts = PdfSaveOptions::None ) |
Save the document changes to a file
- Parameters
-
| filename | filename of the document |
Writes the document changes to a file as an incremental update. The document should be loaded with bForUpdate = true, otherwise an exception is thrown.
Beware when overwriting existing files. Plain file overwrite is allowed only if the document was loaded with the same filename (and the same overloaded function), otherwise the destination file cannot be the same as the source file, because the destination file is truncated first and only then the source file content is copied into it.
- See also
- Save, SaveUpdate
This is an overloaded member function for your convenience.
◆ SaveUpdate() [2/2]
| void PdfMemDocument::SaveUpdate |
( |
OutputStreamDevice & | device, |
|
|
PdfSaveOptions | opts = PdfSaveOptions::None ) |
Save the document changes to an output device
- Parameters
-
| device | write to this output device |
Writes the document changes to the output device as an incremental update. The document should be loaded with bForUpdate = true, otherwise an exception is thrown.
- See also
- Save, SaveUpdate
◆ SetEncrypt()
| void PdfMemDocument::SetEncrypt |
( |
std::unique_ptr< PdfEncrypt > && | encrypt | ) |
|
Encrypt the document during writing using a PdfEncrypt object
- Parameters
-
◆ SetEncrypted()
Encrypt the document during writing.
- Parameters
-
| userPassword | the user password (if empty the user does not have to enter a password to open the document) |
| ownerPassword | the owner password |
| protection | several PdfPermissions values or'ed together to set the users permissions for this document |
| algorithm | the revision of the encryption algorithm to be used |
| keyLength | the length of the encryption key ranging from 40 to 256 bits (only used if algorithm >= PdfEncryptAlgorithm::RC4V2) |
- See also
- PdfEncrypt
◆ SetPdfVersion()
| void PdfMemDocument::SetPdfVersion |
( |
PdfVersion | version | ) |
|
|
overrideprotectedvirtual |
Set the PDF Version of the document. Has to be called before Write() to have an effect.
- Parameters
-
| version | version of the pdf document |
Implements PoDoFo::PdfDocument.
The documentation for this class was generated from the following files:
- PdfMemDocument.h
- PdfMemDocument.cpp