SignatureField.h
1 #pragma once
2 // Copyright (c) 2001-2024 Aspose Pty Ltd. All Rights Reserved.
3 
4 // C# preprocessor directive: #if ASPOSE_PDF_DRAWING
5 
6 // C# INACTIVE CODE:
7 // using ImageFormat = Aspose.Pdf.Drawing.ImageFormat;
8 
9 // C# preprocessor directive: #else
10 
11 
12 // C# preprocessor directive: #endif
13 
14 
15 #include "Aspose.PDF.Cpp/InteractiveFeatures/Forms/Field.h"
16 #include "Aspose.PDF.Cpp/aspose_pdf_api_defs.h"
17 
18 namespace Aspose
19 {
20 namespace Pdf
21 {
22 class Document;
23 namespace Engine
24 {
25 namespace Data
26 {
27 class IPdfObject;
28 class ITrailerable;
29 } // namespace Data
30 } // namespace Engine
31 namespace Facades
32 {
33 class Form;
34 class PdfFileSignature;
35 } // namespace Facades
36 namespace Forms
37 {
38 class Signature;
39 } // namespace Forms
40 class Page;
41 class Rectangle;
42 namespace Text
43 {
44 class Font;
45 } // namespace Text
46 class XForm;
47 } // namespace Pdf
48 } // namespace Aspose
49 namespace System
50 {
51 namespace Drawing
52 {
53 namespace Imaging
54 {
55 class ImageFormat;
56 } // namespace Imaging
57 } // namespace Drawing
58 namespace IO
59 {
60 class Stream;
61 } // namespace IO
62 namespace Security
63 {
64 namespace Cryptography
65 {
66 namespace X509Certificates
67 {
68 class X509Certificate;
69 } // namespace X509Certificates
70 } // namespace Cryptography
71 } // namespace Security
72 } // namespace System
73 
74 namespace Aspose {
75 
76 namespace Pdf {
77 
78 namespace Forms {
79 
83 class ASPOSE_PDF_SHARED_CLASS SignatureField final : public Aspose::Pdf::Forms::Field
84 {
85  typedef SignatureField ThisType;
87 
88  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
89  ASPOSE_PDF_SHARED_RTTI_INFO_DECL();
90 
94 
95 public:
96 
103  ASPOSE_PDF_SHARED_API System::SharedPtr<Aspose::Pdf::Forms::Signature> get_Signature() const;
104 
118 
131 
136  ASPOSE_PDF_SHARED_API void Sign(System::SharedPtr<Aspose::Pdf::Forms::Signature> signature);
141  ASPOSE_PDF_SHARED_API System::SharedPtr<System::IO::Stream> ExtractImage();
152  ASPOSE_PDF_SHARED_API System::SharedPtr<System::IO::Stream> ExtractCertificate();
153 
154 protected:
155 
166 
168  ASPOSE_PDF_SHARED_API void Initialize(System::SharedPtr<Aspose::Pdf::Engine::Data::ITrailerable> trailer) override;
172  void Clear() override;
173  void AddImage(System::SharedPtr<System::IO::Stream> image);
174  ASPOSE_PDF_SHARED_API System::SharedPtr<Field> CreateCopy() override;
175 
176  virtual ASPOSE_PDF_SHARED_API ~SignatureField();
177 
178 private:
179 
181 
183  void AddImageToAppearance(System::SharedPtr<XForm> appearance, System::SharedPtr<System::IO::Stream> image, System::ArrayPtr<double> position);
184  System::ArrayPtr<double> CalculateImagePosition(double width, double height);
186 
187 };
188 
189 } // namespace Forms
190 } // namespace Pdf
191 } // namespace Aspose
192 
193 
String class used across the library. Is a substitute for C# System.String when translating code...
Definition: string.h:121
MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(Field, CODEPORTING_ARGS(System::SharedPtr< Aspose::Pdf::Engine::Data::IPdfObject > annotation, System::SharedPtr< Document > document))
Class representing Acro form object.
Definition: Form.h:115
Definition: Artifact.h:67
Represents signature form field.
Definition: SignatureField.h:83
Base class for acro form fields.
Definition: Field.h:130
ASPOSE_PDF_SHARED_API void Initialize(System::SharedPtr< Aspose::Pdf::Engine::Data::ITrailerable > trailer, System::SharedPtr< Rectangle > rect) override
Initialize the annotation.
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: fwd.h:22
Definition: AFRelationship.h:4
Defies a method that enables object cloning - creating a copy of an object. Objects of this class sho...
Definition: icloneable.h:15
virtual ASPOSE_PDF_SHARED_API System::SharedPtr< Field > CreateCopy()
This method is required for Generator support. This method creates copy of field "template" when gene...
The coordinates are in the page coordinate context.
Represents a class to sign a pdf file with a certificate.
Definition: PdfFileSignature.h:63
ImageFormat
This enum represents image formats.
Definition: ImageFormat.h:13
Represents a abstract base object can be added to the page(doc.Paragraphs.Add()). ...
Definition: BaseParagraph.h:66
Whole PDF file will be submitted.