5#ifndef PDF_MEM_DOCUMENT_H
6#define PDF_MEM_DOCUMENT_H
8#include <podofo/auxiliary/InputDevice.h>
9#include <podofo/auxiliary/OutputDevice.h>
11#include "PdfDocument.h"
12#include "PdfEncryptSession.h"
17class PdfEncryptSession;
169 void SetEncrypt(std::unique_ptr<PdfEncrypt>&&
encrypt);
171 bool HasOwnerPermissions()
const override;
173 const PdfEncrypt* GetEncrypt()
const override;
175 inline size_t GetMagicOffset()
const {
return m_MagicOffset; }
177 inline bool HasBrokenXRef()
const {
return m_HasBrokenXRef; }
183 void SetPdfVersion(PdfVersion version)
override;
185 PdfVersion GetPdfVersion()
const override;
188 PdfMemDocument(
bool empty);
191 void loadFromDevice(std::shared_ptr<InputStreamDevice>&& device, PdfLoadOptions opts,
const std::string_view& password);
196 void initFromParser(PdfParser& parser);
199 void clear()
override;
201 void reset()
override;
203 void beforeWrite(PdfSaveOptions options);
206 PdfMemDocument& operator=(
const PdfMemDocument&) =
delete;
209 PdfVersion m_Version;
210 PdfVersion m_InitialVersion;
211 bool m_HasXRefStream;
212 bool m_HasBrokenXRef;
213 size_t m_MagicOffset;
214 size_t m_PrevXRefOffset;
215 std::unique_ptr<PdfEncryptSession> m_Encrypt;
216 std::shared_ptr<InputStreamDevice> m_device;
PdfDocument is the core interface for working with PDF documents.
Definition PdfDocument.h:108
A class that is used to encrypt a PDF file and set document permissions on the PDF file.
Definition PdfEncrypt.h:111
PdfMemDocument is the core class for reading and manipulating PDF files and writing them back to disk...
Definition PdfMemDocument.h:35
void LoadFromBuffer(const bufferview &buffer, const std::string_view &password)
Load a PdfMemDocument from a buffer in memory.
void Load(std::shared_ptr< InputStreamDevice > device, PdfLoadOptions opts=PdfLoadOptions::None, const std::string_view &password={ })
Load a PdfMemDocument from an input device.
void Load(const std::string_view &filename, PdfLoadOptions opts=PdfLoadOptions::None, const std::string_view &password={ })
Load a PdfMemDocument from a file.
void Save(const std::string_view &filename, PdfSaveOptions opts=PdfSaveOptions::None)
Save the complete document to a file.
void LoadFromBuffer(const bufferview &buffer, PdfLoadOptions opts=PdfLoadOptions::None, const std::string_view &password={ })
Load a PdfMemDocument from a buffer in memory.
void Load(const std::string_view &filename, const std::string_view &password)
Load a PdfMemDocument from a file.
void Load(std::shared_ptr< InputStreamDevice > device, const std::string_view &password)
Load a PdfMemDocument from an input device.
void SaveUpdate(const std::string_view &filename, PdfSaveOptions opts=PdfSaveOptions::None)
Save the document changes to a file.
Convenient type for char array storage and/or buffer with std::string compatibility.
Definition basetypes.h:30
All classes, functions, types and enums of PoDoFo are members of these namespace.
Definition basetypes.h:13
PdfEncryptionAlgorithm
The encryption algorithm.
Definition PdfEncrypt.h:82
PdfSaveOptions
Definition PdfDeclarations.h:429
PdfLoadOptions
Definition PdfDeclarations.h:459
cspan< char > bufferview
Convenient read-only char buffer span.
Definition basetypes.h:15
PdfPermissions
Set user permissions/restrictions on a document.
Definition PdfEncrypt.h:60
PdfKeyLength
A enum specifying a valid keylength for a PDF encryption key.
Definition PdfEncrypt.h:38