PoDoFo 1.2.0
Loading...
Searching...
No Matches
PdfResources.h
1// SPDX-FileCopyrightText: 2007 Dominik Seichter <domseichter@web.de>
2// SPDX-FileCopyrightText: 2021 Francesco Pretto <ceztko@gmail.com>
3// SPDX-License-Identifier: LGPL-2.0-or-later OR MPL-2.0
4
5#ifndef PDF_RESOURCES_H
6#define PDF_RESOURCES_H
7
8#include "PdfElement.h"
9#include "PdfResourceOperations.h"
10
11namespace PoDoFo {
12
13class PdfFont;
14class PdfCanvas;
15
20class PODOFO_API PdfResources final : public PdfDictionaryElement, public PdfResourceOperations
21{
22 friend class PdfPage;
23 friend class PdfXObjectForm;
24 friend class PdfTilingPattern;
25 friend class PdfPainter;
26 friend class PdfAcroForm;
27
28private:
32
33public:
34 static bool TryCreateFromObject(PdfObject& obj, std::unique_ptr<PdfResources>& resources);
35
39 const PdfFont* GetFont(const std::string_view& name) const;
40
45 PdfObject* GetResource(PdfResourceType type, const std::string_view& key) override;
46
51 const PdfObject* GetResource(PdfResourceType type, const std::string_view& key) const override;
52 PdfDictionaryIndirectIterable GetResourceIterator(PdfResourceType type) override;
53 PdfDictionaryConstIndirectIterable GetResourceIterator(PdfResourceType type) const override;
54
55private:
56 PdfName AddResource(PdfResourceType type, const PdfObject& obj) override;
57 void AddResource(PdfResourceType type, const PdfName& key, const PdfObject& obj) override;
58 void RemoveResource(PdfResourceType type, const std::string_view& key) override;
59 void RemoveResources(PdfResourceType type) override;
60 PdfName AddResource(const PdfName& type, const PdfObject& obj) override;
61 void AddResource(const PdfName& type, const PdfName& key, const PdfObject& obj) override;
62 PdfDictionaryIndirectIterable GetResourceIterator(const std::string_view& type) override;
63 PdfDictionaryConstIndirectIterable GetResourceIterator(const std::string_view& type) const override;
64 void RemoveResource(const std::string_view& type, const std::string_view& key) override;
65 void RemoveResources(const std::string_view& type) override;
66 PdfObject* GetResource(const std::string_view& type, const std::string_view& key) override;
67 const PdfObject* GetResource(const std::string_view& type, const std::string_view& key) const override;
68 PdfDictionary* GetResourceDictionary(PdfResourceType type) override;
69 const PdfDictionary* GetResourceDictionary(PdfResourceType type) const override;
70 PdfDictionary* GetResourceDictionary(const std::string_view& type) override;
71 const PdfDictionary* GetResourceDictionary(const std::string_view& type) const override;
72
73private:
74 PdfName addResource(PdfResourceType type, const PdfName& typeName, const PdfObject& obj);
75 PdfObject* getResource(const std::string_view& type, const std::string_view& key) const;
76 PdfDictionary* getResourceDictionary(const std::string_view& type) const;
77 PdfDictionary& getOrCreateResourceDictionary(const PdfName& type);
78
79private:
80 std::array<unsigned, (unsigned)PdfResourceType::Properties> m_currResourceIds;
81};
82
83};
84
85#endif // PDF_RESOURCES_H
An interface that provides the necessary features for a painter to draw onto a PdfObject.
Definition PdfCanvas.h:25
The PDF dictionary data type of PoDoFo (inherits from PdfDataContainer, the base class for such repre...
Definition PdfDictionary.h:77
PdfDocument is the core interface for working with PDF documents.
Definition PdfDocument.h:108
Before you can draw text on a PDF document, you have to create a font object first.
Definition PdfFont.h:42
This class represents a PdfName.
Definition PdfName.h:21
This class represents a PDF indirect Object in memory.
Definition PdfObject.h:31
PdfPage is one page in the pdf document.
Definition PdfPage.h:133
This class provides an easy to use painter object which allows you to draw on a PDF page object.
Definition PdfPainter.h:217
Low level interface for resource handling operations Inherited by PdfResources.
Definition PdfResourceOperations.h:15
A interface that provides a wrapper around /Resources.
Definition PdfResources.h:21
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