PoDoFo 1.0.0-dev
Loading...
Searching...
No Matches
PdfResources.h
1
7#ifndef PDF_RESOURCES_H
8#define PDF_RESOURCES_H
9
10#include "PdfElement.h"
11#include "PdfResourceOperations.h"
12
13namespace PoDoFo {
14
15class PdfFont;
16class PdfCanvas;
17
24class PODOFO_API PdfResources final : public PdfDictionaryElement, public PdfResourceOperations
25{
26 friend class PdfPage;
27 friend class PdfXObjectForm;
28 friend class PdfTilingPattern;
29 friend class PdfPainter;
30 friend class PdfAcroForm;
31
32private:
36
37public:
38 static bool TryCreateFromObject(PdfObject& obj, std::unique_ptr<PdfResources>& resources);
39
40 const PdfFont* GetFont(const std::string_view& name) const;
41
42 PdfObject* GetResource(PdfResourceType type, const std::string_view& key) override;
43 const PdfObject* GetResource(PdfResourceType type, const std::string_view& key) const override;
44 PdfDictionaryIndirectIterable GetResourceIterator(PdfResourceType type) override;
45 PdfDictionaryConstIndirectIterable GetResourceIterator(PdfResourceType type) const override;
46
47private:
48 PdfName AddResource(PdfResourceType type, const PdfObject& obj) override;
49 void AddResource(PdfResourceType type, const PdfName& key, const PdfObject& obj) override;
50 void RemoveResource(PdfResourceType type, const std::string_view& key) override;
51 void RemoveResources(PdfResourceType type) override;
52 PdfName AddResource(const PdfName& type, const PdfObject& obj) override;
53 void AddResource(const PdfName& type, const PdfName& key, const PdfObject& obj) override;
54 PdfDictionaryIndirectIterable GetResourceIterator(const std::string_view& type) override;
55 PdfDictionaryConstIndirectIterable GetResourceIterator(const std::string_view& type) const override;
56 void RemoveResource(const std::string_view& type, const std::string_view& key) override;
57 void RemoveResources(const std::string_view& type) override;
58 PdfObject* GetResource(const std::string_view& type, const std::string_view& key) override;
59 const PdfObject* GetResource(const std::string_view& type, const std::string_view& key) const override;
60
61private:
62 PdfName addResource(PdfResourceType type, const PdfName& typeName, const PdfObject& obj);
63 PdfObject* getResource(const std::string_view& type, const std::string_view& key) const;
64 bool tryGetDictionary(const std::string_view& type, PdfDictionary*& dict) const;
65 PdfDictionary& getOrCreateDictionary(const PdfName& type);
66
67private:
68 std::array<unsigned, (unsigned)PdfResourceType::Properties> m_currResourceIds;
69};
70
71};
72
73#endif // PDF_RESOURCES_H
A interface that provides the necessary features for a painter to draw onto a PdfObject.
Definition PdfCanvas.h:28
The PDF dictionary data type of PoDoFo (inherits from PdfDataContainer, the base class for such repre...
Definition PdfDictionary.h:82
PdfDocument is the core interface for working with PDF documents.
Definition PdfDocument.h:111
Before you can draw text on a PDF document, you have to create a font object first.
Definition PdfFont.h:45
This class represents a PdfName.
Definition PdfName.h:24
This class represents a PDF indirect Object in memory.
Definition PdfObject.h:35
PdfPage is one page in the pdf document.
Definition PdfPage.h:129
This class provides an easy to use painter object which allows you to draw on a PDF page object.
Definition PdfPainter.h:244
Low level interface for resource handling operations Inherited by PdfResources.
Definition PdfResourceOperations.h:19
A interface that provides a wrapper around /Resources.
Definition PdfResources.h:25
Convenient type for char array storage and/or buffer with std::string compatibility.
Definition basetypes.h:38
SPDX-FileCopyrightText: (C) 2022 Francesco Pretto ceztko@gmail.com SPDX-License-Identifier: LGPL-2....
Definition basetypes.h:16