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 class Matrix;
39 class Operator;
40 class OperatorCollection;
41 namespace Operators
42 {
43 class ConcatenateMatrix;
44 class Do;
45 class GS;
46 class SelectFont;
47 class SetRGBColor;
48 } // namespace Operators
49 class Page;
50 class Point;
51 class Rectangle;
52 class Resources;
53 namespace Tests
54 {
55 class RegressionTests_v9_3;
56 } // namespace Tests
57 namespace Text
58 {
59 class TextState;
60 } // namespace Text
61 enum class VerticalAlignment;
62 class WatermarkArtifact;
63 class XForm;
64 class XImage;
65 } // namespace Pdf
66 } // namespace Aspose
67 namespace System
68 {
69 namespace Collections
70 {
71 namespace Generic
72 {
73 template <typename, typename> class Dictionary;
74 template <typename> class List;
75 } // namespace Generic
76 } // namespace Collections
77 namespace IO
78 {
79 class Stream;
80 } // namespace IO
81 } // namespace System
82 
83 namespace Aspose {
84 
85 namespace Pdf {
86 
90 class ASPOSE_PDF_SHARED_CLASS Artifact : public System::IDisposable
91 {
92  typedef Artifact ThisType;
94 
95  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
96  ASPOSE_PDF_SHARED_RTTI_INFO_DECL();
97 
103  friend class Aspose::Pdf::Tests::RegressionTests_v9_3;
104 
105 public:
106 
110  enum class ArtifactType
111  {
115  Pagination,
119  Layout,
123  Page,
127  Background,
131  Undefined
132  };
133 
137  enum class ArtifactSubtype
138  {
142  Header,
146  Footer,
150  Watermark,
154  Background,
158  Undefined
159  };
160 
161 
162 protected:
163 
168  {
169  typedef ArtifactContext ThisType;
170  typedef System::Object BaseType;
171 
172  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
173  RTTI_INFO_DECL();
174 
175  public:
176 
180 
182  ArtifactContext();
183 
184  };
185 
190  {
191  typedef TextAttributes ThisType;
192  typedef System::Object BaseType;
193 
194  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
195  RTTI_INFO_DECL();
196 
197  public:
198 
199  TextAttributes();
200 
201  private:
202 
203  System::Drawing::Color textColor;
204  System::String fontResourceName;
205  double fontSize;
206 
207  };
208 
209 
210 public:
211 
215  ASPOSE_PDF_SHARED_API System::String get_CustomType();
219  ASPOSE_PDF_SHARED_API void set_CustomType(System::String value);
223  ASPOSE_PDF_SHARED_API System::String get_CustomSubtype();
227  ASPOSE_PDF_SHARED_API void set_CustomSubtype(System::String value);
231  ASPOSE_PDF_SHARED_API Artifact::ArtifactType get_Type();
235  ASPOSE_PDF_SHARED_API void set_Type(Artifact::ArtifactType value);
239  ASPOSE_PDF_SHARED_API Artifact::ArtifactSubtype get_Subtype();
243  ASPOSE_PDF_SHARED_API void set_Subtype(Artifact::ArtifactSubtype value);
251  ASPOSE_PDF_SHARED_API System::SharedPtr<XForm> get_Form();
255  ASPOSE_PDF_SHARED_API System::SharedPtr<Aspose::Pdf::Rectangle> get_Rectangle();
260  ASPOSE_PDF_SHARED_API System::SharedPtr<Point> get_Position() const;
265  ASPOSE_PDF_SHARED_API void set_Position(System::SharedPtr<Point> value);
270  ASPOSE_PDF_SHARED_API double get_RightMargin() const;
275  ASPOSE_PDF_SHARED_API void set_RightMargin(double value);
280  ASPOSE_PDF_SHARED_API double get_LeftMargin() const;
285  ASPOSE_PDF_SHARED_API void set_LeftMargin(double value);
290  ASPOSE_PDF_SHARED_API double get_TopMargin() const;
295  ASPOSE_PDF_SHARED_API void set_TopMargin(double value);
300  ASPOSE_PDF_SHARED_API double get_BottomMargin() const;
305  ASPOSE_PDF_SHARED_API void set_BottomMargin(double value);
310  ASPOSE_PDF_SHARED_API HorizontalAlignment get_ArtifactHorizontalAlignment() const;
315  ASPOSE_PDF_SHARED_API void set_ArtifactHorizontalAlignment(HorizontalAlignment value);
320  ASPOSE_PDF_SHARED_API VerticalAlignment get_ArtifactVerticalAlignment() const;
325  ASPOSE_PDF_SHARED_API void set_ArtifactVerticalAlignment(VerticalAlignment value);
329  ASPOSE_PDF_SHARED_API double get_Rotation();
333  ASPOSE_PDF_SHARED_API void set_Rotation(double value);
337  ASPOSE_PDF_SHARED_API System::String get_Text();
341  ASPOSE_PDF_SHARED_API void set_Text(System::String value);
345  ASPOSE_PDF_SHARED_API System::SharedPtr<XImage> get_Image();
349  ASPOSE_PDF_SHARED_API double get_Opacity() const;
353  ASPOSE_PDF_SHARED_API void set_Opacity(double value);
361  ASPOSE_PDF_SHARED_API System::SharedPtr<Aspose::Pdf::Text::TextState> get_TextState() const;
365  ASPOSE_PDF_SHARED_API void set_TextState(System::SharedPtr<Aspose::Pdf::Text::TextState> value);
369  ASPOSE_PDF_SHARED_API bool get_IsBackground() const;
373  ASPOSE_PDF_SHARED_API void set_IsBackground(bool value);
374 
380  ASPOSE_PDF_SHARED_API Artifact(System::String type, System::String subType);
386  ASPOSE_PDF_SHARED_API Artifact(Artifact::ArtifactType type, Artifact::ArtifactSubtype subType);
387 
392  ASPOSE_PDF_SHARED_API void SetText(System::SharedPtr<Facades::FormattedText> formattedText);
398  ASPOSE_PDF_SHARED_API void SetTextAndState(System::String text, System::SharedPtr<Aspose::Pdf::Text::TextState> textState);
404  ASPOSE_PDF_SHARED_API void SetPageNumberReplacementString(System::String value);
410  ASPOSE_PDF_SHARED_API void SetLinesAndState(System::ArrayPtr<System::String> text, System::SharedPtr<Aspose::Pdf::Text::TextState> textState);
415  ASPOSE_PDF_SHARED_API void SetImage(System::SharedPtr<System::IO::Stream> imageStream);
420  ASPOSE_PDF_SHARED_API void SetImage(System::String imageName);
425  ASPOSE_PDF_SHARED_API void SetPdfPage(System::SharedPtr<Page> page);
429  ASPOSE_PDF_SHARED_API void Dispose() override;
435  ASPOSE_PDF_SHARED_API System::String GetValue(System::String name);
441  ASPOSE_PDF_SHARED_API void SetValue(System::String name, System::String value);
446  ASPOSE_PDF_SHARED_API void RemoveValue(System::String name);
455  ASPOSE_PDF_SHARED_API void BeginUpdates();
459  ASPOSE_PDF_SHARED_API void SaveUpdates();
460 
461 protected:
462 
466  double topMargin;
470  double bottomMargin;
474  double leftMargin;
478  double rightMargin;
495  double opacity;
497 
499  System::String get_Tag() const;
500  System::String get_Name();
501  System::SharedPtr<ArtifactCollection> get_Owner() const;
502  void set_Owner(System::SharedPtr<ArtifactCollection> value);
503  System::SharedPtr<Aspose::Pdf::Resources> get_Resources() const;
504  void set_Resources(System::SharedPtr<Aspose::Pdf::Resources> value);
506  System::SharedPtr<System::IO::Stream> get_ImageStream();
507 
518 
529  virtual ASPOSE_PDF_SHARED_API System::SharedPtr<System::Collections::Generic::List<System::SharedPtr<Operator>>> GetOperators();
530  virtual ASPOSE_PDF_SHARED_API void WriteSpecialInfo(System::SharedPtr<XForm> form);
531  virtual ASPOSE_PDF_SHARED_API void ModifyContents(System::SharedPtr<OperatorCollection> contents);
532  virtual ASPOSE_PDF_SHARED_API System::SharedPtr<Artifact> CreateInstance();
537  System::SharedPtr<Artifact> LowLevelClone();
538  virtual ASPOSE_PDF_SHARED_API System::SharedPtr<Artifact> Clone();
539 
540  virtual ASPOSE_PDF_SHARED_API ~Artifact();
541 
542 private:
543 
544  bool updateRequest;
545  bool updatesDelayed;
546  System::String type;
547  System::String subType;
549  System::SharedPtr<Point> position;
550  double rotation;
551  bool ownsImageStream;
564  System::String name;
566  System::String tag;
567  static System::String AsposeCustomData;
568  System::String _pageNumberReplacementString;
569 
574  double get_Scale();
575 
576  bool _isBackground;
577 
578  void CollectOperators();
579  System::String AssembleText();
580  System::SharedPtr<XImage> SearchImageInForm(System::SharedPtr<XForm> form);
591  System::SharedPtr<Point> GetPosition();
592  System::String SubstPageNumber(System::String text);
597  System::String ShowText();
602  System::String ShowImage();
607  System::String ShowPage();
616  void InitializeCustomData();
617  void Update();
618 
619 };
620 
621 } // namespace Pdf
622 } // namespace Aspose
623 
624 template<>
625 struct EnumMetaInfo<Aspose::Pdf::Artifact::ArtifactType>
626 {
627  static const ASPOSE_PDF_SHARED_API std::array<std::pair<Aspose::Pdf::Artifact::ArtifactType, const char_t*>, 5>& values();
628 };
629 
630 template<>
631 struct EnumMetaInfo<Aspose::Pdf::Artifact::ArtifactSubtype>
632 {
633  static const ASPOSE_PDF_SHARED_API std::array<std::pair<Aspose::Pdf::Artifact::ArtifactSubtype, const char_t*>, 5>& values();
634 };
635 
636 
637 
System::SharedPtr< Matrix > initialMatrix
Definition: Artifact.h:179
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:1555
System::String fontName
Definition: Artifact.h:178
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:470
Base class that enables using methods available for System.Object class in C#. All non-trivial classe...
Definition: object.h:64
Definition: Artifact.h:67
Class representing rg operator (set RGB color for non-stroking operators).
Definition: Operator.h:3789
System::SharedPtr< Resources > resources
Definition: Artifact.h:177
double opacity
Definition: Artifact.h:495
double rightMargin
Right margin of artifact.
Definition: Artifact.h:478
Class representing gs operator (set parameters from graphic state parameter dictionary).
Definition: Operator.h:2471
Represent point with fractional coordinates.
Definition: Point.h:38
Class representing Tf operator (set text font and size).
Definition: Operator.h:4954
HorizontalAlignment
Describes horizontal alignment.
Definition: HorizontalAlignment.h:16
VerticalAlignment verticalAlignment
Vertical alignment of artifact.
Definition: Artifact.h:486
System::SharedPtr< System::IO::Stream > imageStream
Definition: Artifact.h:494
Definition: signed_info.h:13
ArtifactType
Enumeration of possuble artifact types.
Definition: Artifact.h:110
Contains text attributes in original artifact
Definition: Artifact.h:189
static System::String AsposeTag
Definition: Artifact.h:496
Class represents collection of operators
Definition: OperatorCollection.h:170
System::SharedPtr< System::Collections::Generic::List< System::String > > text
Definition: Artifact.h:492
Class represents artifact collection.
Definition: ArtifactCollection.h:48
Class representing page resources.
Definition: Resources.h:248
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: fwd.h:22
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:364
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:173
Class describes watermark artifact. This may be used to
Definition: WatermarkArtifact.h:43
Forward declaration of Dictionary class.
Definition: Artifact.h:73
double leftMargin
Left margin of artifact.
Definition: Artifact.h:474
Undefined color type value.
double topMargin
Top margin of artifact.
Definition: Artifact.h:466
Represents a watermark of the page.
Definition: Watermark.h:31
ArtifactSubtype
Enumeration of possible artifacts subtype.
Definition: Artifact.h:137
List forward declaration.
Definition: Artifact.h:74
This class describes state of page (Matrix, selected font etc.)
Definition: Artifact.h:167
Class represent XForm
Definition: XForm.h:185
Class representing Do operator (Invoke XObject).
Definition: Operator.h:1995
HorizontalAlignment horizontalAlignment
Horizontal alginemt of artifact.
Definition: Artifact.h:482
Class represents transformation matrix.
Definition: Matrix.h:98
System::WeakPtr< ArtifactCollection > owner
artifacts collection to which artifact does belongs
Definition: Artifact.h:491
System::SharedPtr< Aspose::Pdf::Text::TextState > textState
Definition: Artifact.h:493
Represents a text state of a text
Definition: TextState.h:135
System::SharedPtr< Engine::Data::IPdfDictionary > engineDict
Definition: Artifact.h:487
Class represents PDF Artifact object.
Definition: Artifact.h:90
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:427
Whole PDF file will be submitted.
Class represents rectangle.
Definition: Rectangle.h:100
A base class for a variety of stream implementations. Objects of this class should only be allocated ...
Definition: stream.h:23