PoDoFo 1.2.0
Loading...
Searching...
No Matches
PdfCanvas.h
1// SPDX-FileCopyrightText: 2006 Dominik Seichter <domseichter@web.de>
2// SPDX-FileCopyrightText: 2020 Francesco Pretto <ceztko@gmail.com>
3// SPDX-License-Identifier: LGPL-2.0-or-later OR MPL-2.0
4
5#ifndef PDF_CANVAS_H
6#define PDF_CANVAS_H
7
8#include "PdfDeclarations.h"
9#include "PdfResources.h"
10#include "PdfArray.h"
11#include <podofo/auxiliary/Corners.h>
12
13namespace PoDoFo {
14
15enum class PdfStreamAppendFlags
16{
17 None = 0,
18 Prepend = 1,
19 NoSaveRestorePrior = 2
20};
21
24class PODOFO_API PdfCanvas
25{
26public:
29 virtual ~PdfCanvas();
30
35 const PdfObject* GetContentsObject() const;
36 PdfObject* GetContentsObject();
37
41 virtual PdfObjectStream& GetOrCreateContentsStream(PdfStreamAppendFlags flags) = 0;
42
45
46 charbuff GetContentsCopy() const;
47
49 void CopyContentsTo(charbuff& buffer) const;
50 virtual void CopyContentsTo(OutputStream& stream) const = 0;
51
54 PdfResources* GetResources();
55 const PdfResources* GetResources() const;
56
57 PdfDictionaryElement& GetElement();
58 const PdfDictionaryElement& GetElement() const;
59
63
65 void EnsureResourcesCreated();
66
69 virtual Corners GetRectRaw() const = 0;
70
74 virtual bool TryGetRotationRadians(double& teta) const = 0;
75
76protected:
77 virtual PdfObject* getContentsObject() = 0;
78 virtual PdfResources* getResources() = 0;
79 virtual PdfDictionaryElement& getElement() = 0;
80};
81
82};
83
84ENABLE_BITMASK_OPERATORS(PoDoFo::PdfStreamAppendFlags);
85
86#endif // PDF_CANVAS_H
This file should be included as the FIRST file in every header of PoDoFo lib.
An unoriented rectangle defined by 2 points.
Definition Corners.h:16
An interface for writing blocks of data to a data source.
Definition OutputStream.h:15
An interface that provides the necessary features for a painter to draw onto a PdfObject.
Definition PdfCanvas.h:25
virtual PdfObjectStream & ResetContentsStream()=0
Reset the contents object and create a new stream for appending.
virtual bool TryGetRotationRadians(double &teta) const =0
Try getting the current canvas rotation.
virtual Corners GetRectRaw() const =0
Get the current canvas size in PDF Units.
virtual PdfObjectStream & GetOrCreateContentsStream(PdfStreamAppendFlags flags)=0
Get access an object that you can use to ADD drawing to.
virtual PdfResources & GetOrCreateResources()=0
Get or create the resource object of this page.
A PDF stream can be appended to any PdfObject and can contain arbitrary data.
Definition PdfObjectStream.h:82
This class represents a PDF indirect Object in memory.
Definition PdfObject.h:31
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
@ None
Do not add a default appearance.