7 #ifndef PDF_MEM_DOCUMENT_H
8 #define PDF_MEM_DOCUMENT_H
10 #include <podofo/auxiliary/InputDevice.h>
11 #include <podofo/auxiliary/OutputDevice.h>
13 #include "PdfDocument.h"
14 #include "PdfExtension.h"
15 #include "PdfEncryptSession.h"
20 class PdfEncryptSession;
40 PODOFO_PRIVATE_FRIEND(
class PdfWriter);
47 PdfMemDocument(
const std::shared_ptr<InputStreamDevice>& device,
const std::string_view& password = { });
62 void Load(
const std::string_view& filename,
const std::string_view& password = { });
70 void LoadFromBuffer(
const bufferview& buffer,
const std::string_view& password = { });
78 void Load(
const std::shared_ptr<InputStreamDevice>& device,
const std::string_view& password = { });
96 void Save(OutputStreamDevice& device,
PdfSaveOptions opts = PdfSaveOptions::None);
128 void SaveUpdate(OutputStreamDevice& device,
PdfSaveOptions opts = PdfSaveOptions::None);
134 void AddPdfExtension(
const PdfName& ns, int64_t level);
141 bool HasPdfExtension(
const std::string_view& ns, int64_t level)
const;
147 void RemovePdfExtension(
const std::string_view& ns, int64_t level);
153 std::vector<PdfExtension> GetPdfExtensions()
const;
168 void SetEncrypted(
const std::string_view& userPassword,
const std::string_view& ownerPassword,
177 void SetEncrypt(std::unique_ptr<PdfEncrypt>&& encrypt);
179 const PdfEncrypt* GetEncrypt()
const override;
186 void SetPdfVersion(
PdfVersion version)
override;
194 void loadFromDevice(
const std::shared_ptr<InputStreamDevice>& device,
const std::string_view& password);
200 void initFromParser(PdfParser& parser);
204 void clear()
override;
206 void reset()
override;
216 bool m_HasXRefStream;
217 int64_t m_PrevXRefOffset;
218 std::unique_ptr<PdfEncryptSession> m_Encrypt;
219 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:122
PdfMemDocument is the core class for reading and manipulating PDF files and writing them back to disk...
Definition: PdfMemDocument.h:39
void Load(const std::shared_ptr< InputStreamDevice > &device, const std::string_view &password={ })
Load a PdfMemDocument from a PdfRefCountedInputDevice.
void Save(const std::string_view &filename, PdfSaveOptions opts=PdfSaveOptions::None)
Save the complete document to a file.
void Load(const std::string_view &filename, const std::string_view &password={ })
Load a PdfMemDocument from a file.
void SaveUpdate(const std::string_view &filename, PdfSaveOptions opts=PdfSaveOptions::None)
Save the document changes to a file.
This class represents a PdfName.
Definition: PdfName.h:24
SPDX-FileCopyrightText: (C) 2022 Francesco Pretto ceztko@gmail.com SPDX-License-Identifier: LGPL-2....
Definition: basetypes.h:16
PdfEncryptionAlgorithm
The encryption algorithm.
Definition: PdfEncrypt.h:90
@ AESV2
AES encryption with a 128 bit key (PDF1.6)
PdfSaveOptions
Definition: PdfDeclarations.h:440
cspan< char > bufferview
Convenient read-only char buffer span.
Definition: basetypes.h:19
PdfPermissions
Set user permissions/restrictions on a document.
Definition: PdfEncrypt.h:66
PdfKeyLength
A enum specifying a valid keylength for a PDF encryption key.
Definition: PdfEncrypt.h:41
PdfVersion
Enum to identify different versions of the PDF file format.
Definition: PdfDeclarations.h:71