PdfFileStamp.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/array.h>
11 #include <cstdint>
12 
13 #include "Aspose.PDF.Cpp/Facades/Facade.h"
14 #include "Aspose.PDF.Cpp/aspose_pdf_api_defs.h"
15 
16 namespace Aspose
17 {
18 namespace Pdf
19 {
20 enum class ContentDisposition;
21 class Document;
22 namespace Facades
23 {
24 enum class BlendingColorSpace;
25 class FormattedText;
26 class Stamp;
27 } // namespace Facades
28 enum class NumberingStyle;
29 class Page;
30 enum class PdfFormat;
31 class SaveOptions;
32 class Stamp;
33 } // namespace Pdf
34 } // namespace Aspose
35 namespace System
36 {
37 namespace IO
38 {
39 class Stream;
40 } // namespace IO
41 namespace Web
42 {
43 class HttpResponse;
44 } // namespace Web
45 } // namespace System
46 
47 namespace Aspose {
48 
49 namespace Pdf {
50 
51 namespace Facades {
52 
56 class ASPOSE_PDF_SHARED_CLASS PdfFileStamp final : public Aspose::Pdf::Facades::SaveableFacade
57 {
58  typedef PdfFileStamp ThisType;
60 
61  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
62  ASPOSE_PDF_SHARED_RTTI_INFO_DECL();
63 
64 public:
65 
69  static const ASPOSE_PDF_SHARED_API int32_t PosBottomMiddle;
73  static const ASPOSE_PDF_SHARED_API int32_t PosBottomRight;
77  static const ASPOSE_PDF_SHARED_API int32_t PosUpperRight;
81  static const ASPOSE_PDF_SHARED_API int32_t PosSidesRight;
85  static const ASPOSE_PDF_SHARED_API int32_t PosUpperMiddle;
89  static const ASPOSE_PDF_SHARED_API int32_t PosBottomLeft;
93  static const ASPOSE_PDF_SHARED_API int32_t PosSidesLeft;
97  static const ASPOSE_PDF_SHARED_API int32_t PosUpperLeft;
98 
104  ASPOSE_PDF_SHARED_API bool get_OptimizeSize() const;
110  ASPOSE_PDF_SHARED_API void set_OptimizeSize(bool value);
114  ASPOSE_PDF_SHARED_API bool get_KeepSecurity() const;
118  ASPOSE_PDF_SHARED_API void set_KeepSecurity(bool value);
123  ASPOSE_PDF_SHARED_API System::String get_InputFile() const;
128  ASPOSE_PDF_SHARED_API void set_InputFile(System::String value);
133  ASPOSE_PDF_SHARED_API System::SharedPtr<System::IO::Stream> get_InputStream() const;
138  ASPOSE_PDF_SHARED_API void set_InputStream(System::SharedPtr<System::IO::Stream> value);
143  ASPOSE_PDF_SHARED_API System::String get_OutputFile() const;
148  ASPOSE_PDF_SHARED_API void set_OutputFile(System::String value);
153  ASPOSE_PDF_SHARED_API System::SharedPtr<System::IO::Stream> get_OutputStream() const;
158  ASPOSE_PDF_SHARED_API void set_OutputStream(System::SharedPtr<System::IO::Stream> value);
162  ASPOSE_PDF_SHARED_API float get_PageNumberRotation();
166  ASPOSE_PDF_SHARED_API void set_PageNumberRotation(float value);
171  ASPOSE_PDF_SHARED_API void set_ConvertTo(PdfFormat value);
177  ASPOSE_PDF_SHARED_API float get_PageHeight();
183  ASPOSE_PDF_SHARED_API float get_PageWidth();
190  ASPOSE_PDF_SHARED_API int32_t get_StartingNumber() const;
197  ASPOSE_PDF_SHARED_API void set_StartingNumber(int32_t value);
201  ASPOSE_PDF_SHARED_API Aspose::Pdf::NumberingStyle get_NumberingStyle() const;
205  ASPOSE_PDF_SHARED_API void set_NumberingStyle(Aspose::Pdf::NumberingStyle value);
209  ASPOSE_PDF_SHARED_API int32_t get_StampId() const;
213  ASPOSE_PDF_SHARED_API void set_StampId(int32_t value);
218  ASPOSE_PDF_SHARED_API Aspose::Pdf::ContentDisposition get_ContentDisposition() const;
223  ASPOSE_PDF_SHARED_API void set_ContentDisposition(Aspose::Pdf::ContentDisposition value);
227  ASPOSE_PDF_SHARED_API System::SharedPtr<System::Web::HttpResponse> get_Response() const;
231  ASPOSE_PDF_SHARED_API void set_Response(System::SharedPtr<System::Web::HttpResponse> value);
236  ASPOSE_PDF_SHARED_API System::SharedPtr<Aspose::Pdf::SaveOptions> get_SaveOptions() const;
241  ASPOSE_PDF_SHARED_API void set_SaveOptions(System::SharedPtr<Aspose::Pdf::SaveOptions> value);
245  ASPOSE_PDF_SHARED_API System::String get_AttachmentName() const;
249  ASPOSE_PDF_SHARED_API void set_AttachmentName(System::String value);
250 
259  ASPOSE_PDF_SHARED_API PdfFileStamp(System::String inputFile, System::String outputFile);
268  ASPOSE_PDF_SHARED_API PdfFileStamp(System::SharedPtr<System::IO::Stream> inputStream, System::SharedPtr<System::IO::Stream> outputStream);
276  ASPOSE_PDF_SHARED_API PdfFileStamp(System::String inputFile, System::String outputFile, bool keepSecurity);
284  ASPOSE_PDF_SHARED_API PdfFileStamp(System::SharedPtr<System::IO::Stream> inputStream, System::SharedPtr<System::IO::Stream> outputStream, bool keepSecurity);
285 
292  ASPOSE_PDF_SHARED_API void Close() override;
297  ASPOSE_PDF_SHARED_API void Save(System::String destFile) override;
302  ASPOSE_PDF_SHARED_API void Save(System::SharedPtr<System::IO::Stream> destStream) override;
309  ASPOSE_PDF_SHARED_API void AddStamp(System::SharedPtr<Stamp> stamp);
317  ASPOSE_PDF_SHARED_API void AddPageNumber(System::String formatString);
325  ASPOSE_PDF_SHARED_API void AddPageNumber(System::SharedPtr<FormattedText> formattedText);
342  ASPOSE_PDF_SHARED_API void AddPageNumber(System::String formatString, int32_t position, float leftMargin, float rightMargin, float topMargin, float bottomMargin);
351  ASPOSE_PDF_SHARED_API void AddPageNumber(System::String formatString, float x, float y);
368  ASPOSE_PDF_SHARED_API void AddPageNumber(System::SharedPtr<FormattedText> formattedText, int32_t position, float leftMargin, float rightMargin, float topMargin, float bottomMargin);
378  ASPOSE_PDF_SHARED_API void AddPageNumber(System::SharedPtr<FormattedText> formattedText, float x, float y);
386  ASPOSE_PDF_SHARED_API void AddHeader(System::SharedPtr<FormattedText> formattedText, float topMargin);
396  ASPOSE_PDF_SHARED_API void AddHeader(System::SharedPtr<FormattedText> formattedText, float topMargin, float leftMargin, float rightMargin);
404  ASPOSE_PDF_SHARED_API void AddHeader(System::String imageFile, float topMargin);
414  ASPOSE_PDF_SHARED_API void AddHeader(System::String imageFile, float topMargin, float leftMargin, float rightMargin);
422  ASPOSE_PDF_SHARED_API void AddHeader(System::SharedPtr<System::IO::Stream> imageStream, float topMargin);
432  ASPOSE_PDF_SHARED_API void AddHeader(System::SharedPtr<System::IO::Stream> inputStream, float topMargin, float leftMargin, float rightMargin);
440  ASPOSE_PDF_SHARED_API void AddFooter(System::SharedPtr<FormattedText> formattedText, float bottomMargin);
450  ASPOSE_PDF_SHARED_API void AddFooter(System::SharedPtr<FormattedText> formattedText, float bottomMargin, float leftMargin, float rightMargin);
458  ASPOSE_PDF_SHARED_API void AddFooter(System::String imageFile, float bottomMargin);
468  ASPOSE_PDF_SHARED_API void AddFooter(System::String imageFile, float bottomMargin, float leftMargin, float rightMargin);
476  ASPOSE_PDF_SHARED_API void AddFooter(System::SharedPtr<System::IO::Stream> imageStream, float bottomMargin);
486  ASPOSE_PDF_SHARED_API void AddFooter(System::SharedPtr<System::IO::Stream> imageStream, float bottomMargin, float leftMargin, float rightMargin);
499  ASPOSE_PDF_SHARED_API void AddPageNumber(System::String formatString, int32_t position);
513  ASPOSE_PDF_SHARED_API void AddPageNumber(System::SharedPtr<FormattedText> formattedText, int32_t position);
514 
521  ASPOSE_PDF_SHARED_API PdfFileStamp();
528  ASPOSE_PDF_SHARED_API PdfFileStamp(System::SharedPtr<Aspose::Pdf::Document> document);
539  ASPOSE_PDF_SHARED_API PdfFileStamp(System::SharedPtr<Aspose::Pdf::Document> document, System::String outputFile);
564  ASPOSE_PDF_SHARED_API PdfFileStamp(System::String inputFile, System::SharedPtr<System::Web::HttpResponse> response);
565 
566 protected:
567 
568  void ApplyStamp(System::SharedPtr<Stamp> stamp);
569 
570 private:
571 
574  System::String _inputFileName;
575  System::String _outputFileName;
576  double _pageNumberRotation;
577  int32_t _startingNumber;
578  bool _keepSecurity;
579  PdfFormat _convertTo;
580  bool _executeConvert;
581  Aspose::Pdf::ContentDisposition _contentDisposition;
583  System::String _attachmentName;
584  bool _optimizeSize;
585  int32_t _stampId;
587  Aspose::Pdf::NumberingStyle _numberingStyle;
588 
589  void PrevClose();
590  void PreSave();
591  void ApplyStamp(System::SharedPtr<Aspose::Pdf::Stamp> stamp);
592  void ApplyStamp(System::SharedPtr<Aspose::Pdf::Stamp> stamp, int32_t pageNumber);
593  void updateGroupColorSpace(BlendingColorSpace colorSpace, System::ArrayPtr<int32_t> pages);
594  static void UpdateGroupColorSpace(BlendingColorSpace colorSpace, System::SharedPtr<Page> page);
595  void TranslatePosition(int32_t position, System::SharedPtr<Aspose::Pdf::Stamp> stamp);
596 
597 };
598 
599 } // namespace Facades
600 } // namespace Pdf
601 } // namespace Aspose
602 
603 
String class used across the library. Is a substitute for C# System.String when translating code...
Definition: string.h:121
NumberingStyle
Enumeration of supported page numbering style for PageLabel class.
Definition: NumberingStyle.h:16
Base class for all saveable facades.
Definition: Facade.h:151
static const ASPOSE_PDF_SHARED_API int32_t PosUpperLeft
Upper let position.
Definition: PdfFileStamp.h:97
Definition: Artifact.h:67
Base facade class.
Definition: Facade.h:57
static const ASPOSE_PDF_SHARED_API int32_t PosBottomMiddle
Bottom middle position.
Definition: PdfFileStamp.h:69
PdfFormat
This class represents an pdf format.
Definition: PdfFormat.h:16
static const ASPOSE_PDF_SHARED_API int32_t PosUpperMiddle
Upper middle position.
Definition: PdfFileStamp.h:85
Class for adding stamps (watermark or background) to PDF files.
Definition: PdfFileStamp.h:56
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: fwd.h:22
General facade interface that defines common facades methods.
Definition: IFacade.h:33
static const ASPOSE_PDF_SHARED_API int32_t PosBottomRight
Bottom right position.
Definition: PdfFileStamp.h:73
Definition: AFRelationship.h:4
BlendingColorSpace
Class represents blending color space.
Definition: BlendingColorSpace.h:13
static const ASPOSE_PDF_SHARED_API int32_t PosSidesLeft
Left position.
Definition: PdfFileStamp.h:93
The coordinates are in the page coordinate context.
ContentDisposition
MIME protocol Content-Disposition header.
Definition: ContentDisposition.h:11
static const ASPOSE_PDF_SHARED_API int32_t PosBottomLeft
Bottom left position.
Definition: PdfFileStamp.h:89
static const ASPOSE_PDF_SHARED_API int32_t PosUpperRight
Right upper position.
Definition: PdfFileStamp.h:77
static const ASPOSE_PDF_SHARED_API int32_t PosSidesRight
Right position.
Definition: PdfFileStamp.h:81
Whole PDF file will be submitted.