10#include <podofo/auxiliary/Matrix.h>
11#include <podofo/auxiliary/Rect.h>
17class PdfXObjectPostScript;
29 friend class PdfXObjectForm;
31 friend class PdfXObjectPostScript;
40 static bool TryCreateFromObject(
PdfObject&
obj, std::unique_ptr<PdfXObject>&
xobj);
42 static bool TryCreateFromObject(
const PdfObject&
obj, std::unique_ptr<const PdfXObject>&
xobj);
44 template <
typename XObjectT>
45 static bool TryCreateFromObject(
PdfObject&
obj, std::unique_ptr<XObjectT>&
xobj);
47 template <
typename XObjectT>
48 static bool TryCreateFromObject(
const PdfObject&
obj, std::unique_ptr<const XObjectT>&
xobj);
50 virtual Rect GetRect()
const = 0;
52 virtual const Matrix& GetMatrix()
const;
54 inline PdfXObjectType GetType()
const {
return m_Type; }
57 virtual PdfXObjectForm* getForm()
const;
64 template <
typename TXObject>
65 static constexpr PdfXObjectType GetXObjectType();
67 PdfXObjectForm* GetForm() {
return getForm(); }
69 const PdfXObjectForm* GetForm()
const {
return getForm(); }
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:68
Reader class to read content streams.
Definition PdfContentStreamReader.h:123
PdfDocument is the core interface for working with PDF documents.
Definition PdfDocument.h:108
A PdfImage object is needed when ever you want to embed an image file into a PDF document.
Definition PdfImage.h:68
This class represents a PDF indirect Object in memory.
Definition PdfObject.h:31
A XObject is a content stream with several drawing commands and data which can be used throughout a P...
Definition PdfXObject.h:28
An normalized rectangle defined by position (left-bottom) and size.
Definition Rect.h:17
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