Artifact.h
1 #pragma once
2 // Copyright (c) 2001-2024 Aspose Pty Ltd. All Rights Reserved.
3 
4 // C# preprocessor directive: #if !NETCORE
5 
6 
7 // C# preprocessor directive: #endif
8 
9 
10 #include <system/object_ext.h>
11 #include <system/idisposable.h>
12 #include <system/enum.h>
13 #include <system/array.h>
14 #include <drawing/color.h>
15 
16 #include "Aspose.PDF.Cpp/aspose_pdf_api_defs.h"
17 
18 namespace Aspose
19 {
20 namespace Pdf
21 {
22 class ArtifactCollection;
23 class BackgroundArtifact;
24 namespace Engine
25 {
26 namespace Data
27 {
28 class IPdfDictionary;
29 } // namespace Data
30 } // namespace Engine
31 namespace Facades
32 {
33 class FormattedText;
34 } // namespace Facades
35 class FooterArtifact;
36 class HeaderArtifact;
37 enum class HorizontalAlignment;
38 namespace LogicalStructure
39 {
40 class StructureElement;
41 } // namespace LogicalStructure
42 class Matrix;
43 class Operator;
44 class OperatorCollection;
45 namespace Operators
46 {
47 class ConcatenateMatrix;
48 class Do;
49 class GS;
50 class SelectFont;
51 class SetRGBColor;
52 } // namespace Operators
53 class Page;
54 class Point;
55 class Rectangle;
56 class Resources;
57 namespace Tests
58 {
59 class RegressionTests_v9_3;
60 } // namespace Tests
61 namespace Text
62 {
63 class TextState;
64 } // namespace Text
65 enum class VerticalAlignment;
66 class WatermarkArtifact;
67 class XForm;
68 class XImage;
69 } // namespace Pdf
70 } // namespace Aspose
71 namespace System
72 {
73 namespace Collections
74 {
75 namespace Generic
76 {
77 template <typename, typename> class Dictionary;
78 template <typename> class List;
79 } // namespace Generic
80 } // namespace Collections
81 namespace IO
82 {
83 class Stream;
84 } // namespace IO
85 } // namespace System
86 
87 namespace Aspose {
88 
89 namespace Pdf {
90 
94 class ASPOSE_PDF_SHARED_CLASS Artifact : public System::IDisposable
95 {
96  typedef Artifact ThisType;
98 
99  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
100  ASPOSE_PDF_SHARED_RTTI_INFO_DECL();
101 
108  friend class Aspose::Pdf::Tests::RegressionTests_v9_3;
109 
110 public:
111 
115  enum class ArtifactType
116  {
120  Pagination,
124  Layout,
128  Page,
132  Background,
136  Undefined
137  };
138 
142  enum class ArtifactSubtype
143  {
147  Header,
151  Footer,
155  Watermark,
159  Background,
163  Undefined
164  };
165 
166 
167 protected:
168 
173  {
174  typedef ArtifactContext ThisType;
175  typedef System::Object BaseType;
176 
177  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
178  RTTI_INFO_DECL();
179 
180  public:
181 
185 
187  ArtifactContext();
188 
189  };
190 
195  {
196  typedef TextAttributes ThisType;
197  typedef System::Object BaseType;
198 
199  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
200  RTTI_INFO_DECL();
201 
202  public:
203 
204  TextAttributes();
205 
206  private:
207 
208  System::Drawing::Color textColor;
209  System::String fontResourceName;
210  double fontSize;
211 
212  };
213 
214 
215 public:
216 
220  ASPOSE_PDF_SHARED_API System::String get_CustomType();
224  ASPOSE_PDF_SHARED_API void set_CustomType(System::String value);
228  ASPOSE_PDF_SHARED_API System::String get_CustomSubtype();
232  ASPOSE_PDF_SHARED_API void set_CustomSubtype(System::String value);
236  ASPOSE_PDF_SHARED_API Artifact::ArtifactType get_Type();
240  ASPOSE_PDF_SHARED_API void set_Type(Artifact::ArtifactType value);
244  ASPOSE_PDF_SHARED_API Artifact::ArtifactSubtype get_Subtype();
248  ASPOSE_PDF_SHARED_API void set_Subtype(Artifact::ArtifactSubtype value);
256  ASPOSE_PDF_SHARED_API System::SharedPtr<XForm> get_Form();
260  ASPOSE_PDF_SHARED_API System::SharedPtr<Aspose::Pdf::Rectangle> get_Rectangle();
265  ASPOSE_PDF_SHARED_API System::SharedPtr<Point> get_Position() const;
270  ASPOSE_PDF_SHARED_API void set_Position(System::SharedPtr<Point> value);
275  ASPOSE_PDF_SHARED_API double get_RightMargin() const;
280  ASPOSE_PDF_SHARED_API void set_RightMargin(double value);
285  ASPOSE_PDF_SHARED_API double get_LeftMargin() const;
290  ASPOSE_PDF_SHARED_API void set_LeftMargin(double value);
295  ASPOSE_PDF_SHARED_API double get_TopMargin() const;
300  ASPOSE_PDF_SHARED_API void set_TopMargin(double value);
305  ASPOSE_PDF_SHARED_API double get_BottomMargin() const;
310  ASPOSE_PDF_SHARED_API void set_BottomMargin(double value);
315  ASPOSE_PDF_SHARED_API HorizontalAlignment get_ArtifactHorizontalAlignment() const;
320  ASPOSE_PDF_SHARED_API void set_ArtifactHorizontalAlignment(HorizontalAlignment value);
325  ASPOSE_PDF_SHARED_API VerticalAlignment get_ArtifactVerticalAlignment() const;
330  ASPOSE_PDF_SHARED_API void set_ArtifactVerticalAlignment(VerticalAlignment value);
334  ASPOSE_PDF_SHARED_API double get_Rotation();
338  ASPOSE_PDF_SHARED_API void set_Rotation(double value);
342  ASPOSE_PDF_SHARED_API System::String get_Text();
346  ASPOSE_PDF_SHARED_API void set_Text(System::String value);
350  ASPOSE_PDF_SHARED_API System::SharedPtr<XImage> get_Image();
354  ASPOSE_PDF_SHARED_API double get_Opacity() const;
358  ASPOSE_PDF_SHARED_API void set_Opacity(double value);
366  ASPOSE_PDF_SHARED_API System::SharedPtr<Aspose::Pdf::Text::TextState> get_TextState() const;
370  ASPOSE_PDF_SHARED_API void set_TextState(System::SharedPtr<Aspose::Pdf::Text::TextState> value);
374  ASPOSE_PDF_SHARED_API bool get_IsBackground() const;
378  ASPOSE_PDF_SHARED_API void set_IsBackground(bool value);
379 
385  ASPOSE_PDF_SHARED_API Artifact(System::String type, System::String subType);
391  ASPOSE_PDF_SHARED_API Artifact(Artifact::ArtifactType type, Artifact::ArtifactSubtype subType);
392 
397  ASPOSE_PDF_SHARED_API void SetText(System::SharedPtr<Facades::FormattedText> formattedText);
403  ASPOSE_PDF_SHARED_API void SetTextAndState(System::String text, System::SharedPtr<Aspose::Pdf::Text::TextState> textState);
409  ASPOSE_PDF_SHARED_API void SetPageNumberReplacementString(System::String value);
415  ASPOSE_PDF_SHARED_API void SetLinesAndState(System::ArrayPtr<System::String> text, System::SharedPtr<Aspose::Pdf::Text::TextState> textState);
420  ASPOSE_PDF_SHARED_API void SetImage(System::SharedPtr<System::IO::Stream> imageStream);
425  ASPOSE_PDF_SHARED_API void SetImage(System::String imageName);
430  ASPOSE_PDF_SHARED_API void SetPdfPage(System::SharedPtr<Page> page);
434  ASPOSE_PDF_SHARED_API void Dispose() override;
440  ASPOSE_PDF_SHARED_API System::String GetValue(System::String name);
446  ASPOSE_PDF_SHARED_API void SetValue(System::String name, System::String value);
451  ASPOSE_PDF_SHARED_API void RemoveValue(System::String name);
460  ASPOSE_PDF_SHARED_API void BeginUpdates();
464  ASPOSE_PDF_SHARED_API void SaveUpdates();
465 
466 protected:
467 
471  double topMargin;
475  double bottomMargin;
479  double leftMargin;
483  double rightMargin;
500  double opacity;
502 
504  System::String get_Tag() const;
505  System::String get_Name();
506  System::SharedPtr<ArtifactCollection> get_Owner() const;
507  void set_Owner(System::SharedPtr<ArtifactCollection> value);
508  System::SharedPtr<Aspose::Pdf::Resources> get_Resources() const;
509  void set_Resources(System::SharedPtr<Aspose::Pdf::Resources> value);
511  System::SharedPtr<System::IO::Stream> get_ImageStream();
512 
523 
534  virtual ASPOSE_PDF_SHARED_API System::SharedPtr<System::Collections::Generic::List<System::SharedPtr<Operator>>> GetOperators();
535  virtual ASPOSE_PDF_SHARED_API void WriteSpecialInfo(System::SharedPtr<XForm> form);
536  virtual ASPOSE_PDF_SHARED_API void ModifyContents(System::SharedPtr<OperatorCollection> contents);
537  virtual ASPOSE_PDF_SHARED_API System::SharedPtr<Artifact> CreateInstance();
542  System::SharedPtr<Artifact> LowLevelClone();
543  virtual ASPOSE_PDF_SHARED_API System::SharedPtr<Artifact> Clone();
544 
545  virtual ASPOSE_PDF_SHARED_API ~Artifact();
546 
547 private:
548 
549  bool updateRequest;
550  bool updatesDelayed;
551  System::String type;
552  System::String subType;
554  System::SharedPtr<Point> position;
555  double rotation;
556  bool ownsImageStream;
569  System::String name;
571  System::String tag;
572  static System::String AsposeCustomData;
573  System::String _pageNumberReplacementString;
574 
579  double get_Scale();
580 
581  bool _isBackground;
582 
583  void CollectOperators();
584  System::String AssembleText();
585  System::SharedPtr<XImage> SearchImageInForm(System::SharedPtr<XForm> form);
596  System::SharedPtr<Point> GetPosition();
597  System::String SubstPageNumber(System::String text);
602  System::String ShowText();
607  System::String ShowImage();
612  System::String ShowPage();
621  void InitializeCustomData();
622  void Update();
623 
624 };
625 
626 } // namespace Pdf
627 } // namespace Aspose
628 
629 template<>
630 struct EnumMetaInfo<Aspose::Pdf::Artifact::ArtifactType>
631 {
632  static const ASPOSE_PDF_SHARED_API std::array<std::pair<Aspose::Pdf::Artifact::ArtifactType, const char_t*>, 5>& values();
633 };
634 
635 template<>
636 struct EnumMetaInfo<Aspose::Pdf::Artifact::ArtifactSubtype>
637 {
638  static const ASPOSE_PDF_SHARED_API std::array<std::pair<Aspose::Pdf::Artifact::ArtifactSubtype, const char_t*>, 5>& values();
639 };
640 
641 
642 
System::SharedPtr< Matrix > initialMatrix
Definition: Artifact.h:184
VerticalAlignment
Enumeration of possible vertical alignment values.
Definition: VerticalAlignment.h:16
Class which represents formatted text. Contains information about text and its color, size, style.
Definition: FormattedText.h:65
String class used across the library. Is a substitute for C# System.String when translating code...
Definition: string.h:121
Class representing cm operator (concatenate matrix to current transformation matrix).
Definition: Operator.h:1588
System::String fontName
Definition: Artifact.h:183
Class descibes background artifact. This artifact allows to set background of the page...
Definition: BackgroundArtifact.h:48
double bottomMargin
Bottom margin of artifact.
Definition: Artifact.h:475
Base class that enables using methods available for System.Object class in C#. All non-trivial classe...
Definition: object.h:64
Definition: Artifact.h:71
Class representing rg operator (set RGB color for non-stroking operators).
Definition: Operator.h:3814
System::SharedPtr< Resources > resources
Definition: Artifact.h:182
double opacity
Definition: Artifact.h:500
Represents a base class for structure elements in logical structure.
Definition: StructureElement.h:85
double rightMargin
Right margin of artifact.
Definition: Artifact.h:483
Class representing gs operator (set parameters from graphic state parameter dictionary).
Definition: Operator.h:2495
Represent point with fractional coordinates.
Definition: Point.h:38
Class representing Tf operator (set text font and size).
Definition: Operator.h:4972
HorizontalAlignment
Describes horizontal alignment.
Definition: HorizontalAlignment.h:16
VerticalAlignment verticalAlignment
Vertical alignment of artifact.
Definition: Artifact.h:491
System::SharedPtr< System::IO::Stream > imageStream
Definition: Artifact.h:499
Definition: signed_info.h:13
ArtifactType
Enumeration of possuble artifact types.
Definition: Artifact.h:115
Contains text attributes in original artifact
Definition: Artifact.h:194
static System::String AsposeTag
Definition: Artifact.h:501
Class represents collection of operators
Definition: OperatorCollection.h:174
System::SharedPtr< System::Collections::Generic::List< System::String > > text
Definition: Artifact.h:497
Class represents artifact collection.
Definition: ArtifactCollection.h:52
Class representing page resources.
Definition: Resources.h:267
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: SideBySidePdfComparer.h:24
Represents a text type.
Defines method that releases resources owned by the current object. Objects of this class should only...
Definition: idisposable.h:29
Class representing page of PDF document.
Definition: Page.h:384
Definition: AFRelationship.h:4
Represents a color. This type should be allocated on stack and passed to functions by value or by ref...
Definition: color.h:23
Subclass of System::SmartPtr which sets itself to weak mode at construction. Please note that this cl...
Definition: TextFragmentState.h:69
Class representing image X-Object.
Definition: XImage.h:178
Class describes watermark artifact. This may be used to
Definition: WatermarkArtifact.h:43
Forward declaration of Dictionary class.
Definition: Artifact.h:77
double leftMargin
Left margin of artifact.
Definition: Artifact.h:479
Undefined color type value.
double topMargin
Top margin of artifact.
Definition: Artifact.h:471
Represents a watermark of the page.
Definition: Watermark.h:31
ArtifactSubtype
Enumeration of possible artifacts subtype.
Definition: Artifact.h:142
List forward declaration.
Definition: Artifact.h:78
This class describes state of page (Matrix, selected font etc.)
Definition: Artifact.h:172
Class represent XForm
Definition: XForm.h:199
Class representing Do operator (Invoke XObject).
Definition: Operator.h:2029
HorizontalAlignment horizontalAlignment
Horizontal alginemt of artifact.
Definition: Artifact.h:487
Class represents transformation matrix.
Definition: Matrix.h:102
System::WeakPtr< ArtifactCollection > owner
artifacts collection to which artifact does belongs
Definition: Artifact.h:496
System::SharedPtr< Aspose::Pdf::Text::TextState > textState
Definition: Artifact.h:498
Represents a text state of a text
Definition: TextState.h:135
System::SharedPtr< Engine::Data::IPdfDictionary > engineDict
Definition: Artifact.h:492
Class represents PDF Artifact object.
Definition: Artifact.h:94
Class describes Heaader artifact. This artifacgt may be used to set heading of the page...
Definition: HeaderArtifact.h:40
Abstract class representing operator.
Definition: Operator.h:445
Whole PDF file will be submitted.
Class represents rectangle.
Definition: Rectangle.h:116
A base class for a variety of stream implementations. Objects of this class should only be allocated ...
Definition: stream.h:23