10#include "PdfElement.h"
12#include <podofo/auxiliary/Matrix.h>
13#include <podofo/auxiliary/Rect.h>
19class PdfXObjectPostScript;
32 friend class PdfXObjectForm;
34 friend class PdfXObjectPostScript;
43 static bool TryCreateFromObject(
PdfObject&
obj, std::unique_ptr<PdfXObject>&
xobj);
45 static bool TryCreateFromObject(
const PdfObject&
obj, std::unique_ptr<const PdfXObject>&
xobj);
47 template <
typename XObjectT>
48 static bool TryCreateFromObject(
PdfObject&
obj, std::unique_ptr<XObjectT>&
xobj);
50 template <
typename XObjectT>
51 static bool TryCreateFromObject(
const PdfObject&
obj, std::unique_ptr<const XObjectT>&
xobj);
53 virtual Rect GetRect()
const = 0;
55 virtual const Matrix& GetMatrix()
const;
57 inline PdfXObjectType GetType()
const {
return m_Type; }
60 virtual const PdfXObjectForm* GetForm()
const;
67 static PdfXObjectType getPdfXObjectType(
const PdfObject&
obj);
68 template <
typename TXObject>
69 static constexpr PdfXObjectType GetXObjectType();
72 PdfXObjectType m_Type;
75template<
typename XObjectT>
76inline bool PdfXObject::TryCreateFromObject(
PdfObject&
obj, std::unique_ptr<XObjectT>&
xobj)
80 return xobj !=
nullptr;
83template<
typename XObjectT>
84inline bool PdfXObject::TryCreateFromObject(
const PdfObject& obj, std::unique_ptr<const XObjectT>& xobj)
86 PdfXObjectType detectedType;
87 xobj.reset((
const XObjectT*)createFromObject(obj, GetXObjectType<XObjectT>(), detectedType));
88 return xobj !=
nullptr;
91template<
typename TXObject>
92constexpr PdfXObjectType PdfXObject::GetXObjectType()
94 if (std::is_same_v<TXObject, PdfXObjectForm>)
95 return PdfXObjectType::Form;
96 else if (std::is_same_v<TXObject, PdfImage>)
97 return PdfXObjectType::Image;
98 else if (std::is_same_v<TXObject, PdfXObjectPostScript>)
99 return PdfXObjectType::PostScript;
101 return PdfXObjectType::Unknown;
An annotation to a PdfPage To create an annotation use PdfPage::CreateAnnotation.
Definition PdfAnnotation.h:63
Reader class to read content streams.
Definition PdfContentStreamReader.h:82
PdfDocument is the core interface for working with PDF documents.
Definition PdfDocument.h:111
A PdfImage object is needed when ever you want to embed an image file into a PDF document.
Definition PdfImage.h:78
This class represents a PDF indirect Object in memory.
Definition PdfObject.h:35
A XObject is a content stream with several drawing commands and data which can be used throughout a P...
Definition PdfXObject.h:31
An normalized rectangle defined by position (left-bottom) and size.
Definition Rect.h:20
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