10#include <podofo/auxiliary/Matrix.h>
11#include <podofo/auxiliary/Rect.h>
17class PdfXObjectPostScript;
30 friend class PdfXObjectForm;
32 friend class PdfXObjectPostScript;
41 static bool TryCreateFromObject(
PdfObject&
obj, std::unique_ptr<PdfXObject>&
xobj);
43 static bool TryCreateFromObject(
const PdfObject&
obj, std::unique_ptr<const PdfXObject>&
xobj);
45 template <
typename XObjectT>
46 static bool TryCreateFromObject(
PdfObject&
obj, std::unique_ptr<XObjectT>&
xobj);
48 template <
typename XObjectT>
49 static bool TryCreateFromObject(
const PdfObject&
obj, std::unique_ptr<const XObjectT>&
xobj);
51 virtual Rect GetRect()
const = 0;
53 virtual const Matrix& GetMatrix()
const;
55 inline PdfXObjectType GetType()
const {
return m_Type; }
58 virtual const PdfXObjectForm* GetForm()
const;
65 static PdfXObjectType getPdfXObjectType(
const PdfObject&
obj);
66 template <
typename TXObject>
67 static constexpr PdfXObjectType GetXObjectType();
70 PdfXObjectType m_Type;
73template<
typename XObjectT>
74inline bool PdfXObject::TryCreateFromObject(
PdfObject&
obj, std::unique_ptr<XObjectT>&
xobj)
78 return xobj !=
nullptr;
81template<
typename XObjectT>
82inline bool PdfXObject::TryCreateFromObject(
const PdfObject& obj, std::unique_ptr<const XObjectT>& xobj)
84 PdfXObjectType detectedType;
85 xobj.reset((
const XObjectT*)createFromObject(obj, GetXObjectType<XObjectT>(), detectedType));
86 return xobj !=
nullptr;
89template<
typename TXObject>
90constexpr PdfXObjectType PdfXObject::GetXObjectType()
92 if (std::is_same_v<TXObject, PdfXObjectForm>)
93 return PdfXObjectType::Form;
94 else if (std::is_same_v<TXObject, PdfImage>)
95 return PdfXObjectType::Image;
96 else if (std::is_same_v<TXObject, PdfXObjectPostScript>)
97 return PdfXObjectType::PostScript;
99 return PdfXObjectType::Unknown;
An annotation to a PdfPage To create an annotation use PdfPage::CreateAnnotation.
Definition PdfAnnotation.h:61
Reader class to read content streams.
Definition PdfContentStreamReader.h:131
PdfDocument is the core interface for working with PDF documents.
Definition PdfDocument.h:109
A PdfImage object is needed when ever you want to embed an image file into a PDF document.
Definition PdfImage.h:69
This class represents a PDF indirect Object in memory.
Definition PdfObject.h:33
A XObject is a content stream with several drawing commands and data which can be used throughout a P...
Definition PdfXObject.h:29
An normalized rectangle defined by position (left-bottom) and size.
Definition Rect.h:18
Convenient type for char array storage and/or buffer with std::string compatibility.
Definition basetypes.h:35
All classes, functions, types and enums of PoDoFo are members of these namespace.
Definition basetypes.h:13