PdfConverter.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 <system/nullable.h>
16 #include <system/array.h>
17 #include <cstdint>
18 
19 #include "Aspose.PDF.Cpp/Facades/Facade.h"
20 #include "Aspose.PDF.Cpp/aspose_pdf_api_defs.h"
21 
22 namespace Aspose
23 {
24 namespace Pdf
25 {
26 namespace Devices
27 {
28 enum class CompressionType;
29 enum class FormPresentationMode;
30 class ImageDevice;
31 class Resolution;
32 class TiffSettings;
33 } // namespace Devices
34 class Document;
35 namespace Drawing
36 {
37 enum class ImageFormat;
38 } // namespace Drawing
39 namespace Facades
40 {
41 enum class ImageMergeMode;
42 } // namespace Facades
43 enum class HorizontalAlignment;
44 class IIndexBitmapConverter;
45 class Page;
46 enum class PageCoordinateType;
47 class PageSize;
48 class RenderingOptions;
49 namespace Tests
50 {
51 namespace Fonts
52 {
53 class FontConversionTests;
54 } // namespace Fonts
55 } // namespace Tests
56 enum class VerticalAlignment;
57 } // namespace Pdf
58 } // namespace Aspose
59 namespace System
60 {
61 namespace Collections
62 {
63 namespace Generic
64 {
65 template <typename> class List;
66 } // namespace Generic
67 } // namespace Collections
68 namespace Drawing
69 {
70 class Graphics;
71 namespace Imaging
72 {
73 class ImageFormat;
74 } // namespace Imaging
75 class Rectangle;
76 } // namespace Drawing
77 namespace IO
78 {
79 class MemoryStream;
80 class Stream;
81 } // namespace IO
82 } // namespace System
83 
84 namespace Aspose {
85 
86 namespace Pdf {
87 
88 namespace Facades {
89 
94 class ASPOSE_PDF_SHARED_CLASS PdfConverter final : public Aspose::Pdf::Facades::Facade
95 {
96  typedef PdfConverter ThisType;
98 
99  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
100  ASPOSE_PDF_SHARED_RTTI_INFO_DECL();
101 
102  friend class Aspose::Pdf::Document;
103  friend class Aspose::Pdf::Tests::Fonts::FontConversionTests;
104 
105 public:
106 
110  ASPOSE_PDF_SHARED_API PageCoordinateType get_CoordinateType() const;
114  ASPOSE_PDF_SHARED_API void set_CoordinateType(PageCoordinateType value);
119  ASPOSE_PDF_SHARED_API bool get_ShowHiddenAreas() const;
124  ASPOSE_PDF_SHARED_API void set_ShowHiddenAreas(bool value);
128  ASPOSE_PDF_SHARED_API System::SharedPtr<Aspose::Pdf::RenderingOptions> get_RenderingOptions() const;
132  ASPOSE_PDF_SHARED_API void set_RenderingOptions(System::SharedPtr<Aspose::Pdf::RenderingOptions> value);
136  ASPOSE_PDF_SHARED_API Aspose::Pdf::Devices::FormPresentationMode get_FormPresentationMode() const;
140  ASPOSE_PDF_SHARED_API void set_FormPresentationMode(Aspose::Pdf::Devices::FormPresentationMode value);
144  ASPOSE_PDF_SHARED_API System::SharedPtr<Aspose::Pdf::Devices::Resolution> get_Resolution() const;
148  ASPOSE_PDF_SHARED_API void set_Resolution(System::SharedPtr<Aspose::Pdf::Devices::Resolution> value);
152  ASPOSE_PDF_SHARED_API int32_t get_StartPage() const;
156  ASPOSE_PDF_SHARED_API void set_StartPage(int32_t value);
160  ASPOSE_PDF_SHARED_API int32_t get_EndPage();
164  ASPOSE_PDF_SHARED_API void set_EndPage(int32_t value);
168  ASPOSE_PDF_SHARED_API System::String get_Password() const;
172  ASPOSE_PDF_SHARED_API void set_Password(System::String value);
176  ASPOSE_PDF_SHARED_API System::String get_UserPassword() const;
180  ASPOSE_PDF_SHARED_API void set_UserPassword(System::String value);
184  ASPOSE_PDF_SHARED_API int32_t get_PageCount();
185 
191  ASPOSE_PDF_SHARED_API void DoConvert();
198  ASPOSE_PDF_SHARED_API void SaveAsTIFF(System::String outputFile);
206  ASPOSE_PDF_SHARED_API void SaveAsTIFF(System::String outputFile, Aspose::Pdf::Devices::CompressionType compressionType);
213  ASPOSE_PDF_SHARED_API void SaveAsTIFF(System::String outputFile, int32_t imageWidth, int32_t imageHeight);
219  ASPOSE_PDF_SHARED_API void SaveAsTIFF(System::String outputFile, System::SharedPtr<PageSize> pageSize);
226  ASPOSE_PDF_SHARED_API void SaveAsTIFF(System::String outputFile, System::SharedPtr<PageSize> pageSize, System::SharedPtr<Aspose::Pdf::Devices::TiffSettings> settings);
234  ASPOSE_PDF_SHARED_API void SaveAsTIFF(System::String outputFile, int32_t imageWidth, int32_t imageHeight, Aspose::Pdf::Devices::CompressionType compressionType);
242  ASPOSE_PDF_SHARED_API void SaveAsTIFF(System::String outputFile, int32_t imageWidth, int32_t imageHeight, System::SharedPtr<Aspose::Pdf::Devices::TiffSettings> settings);
251  ASPOSE_PDF_SHARED_API void SaveAsTIFF(System::String outputFile, int32_t imageWidth, int32_t imageHeight, System::SharedPtr<Aspose::Pdf::Devices::TiffSettings> settings, System::SharedPtr<IIndexBitmapConverter> converter);
260  ASPOSE_PDF_SHARED_API void SaveAsTIFFClassF(System::String outputFile, int32_t imageWidth, int32_t imageHeight);
266  ASPOSE_PDF_SHARED_API void SaveAsTIFFClassF(System::String outputFile, System::SharedPtr<PageSize> pageSize);
273  ASPOSE_PDF_SHARED_API void SaveAsTIFFClassF(System::SharedPtr<System::IO::Stream> outputStream, int32_t imageWidth, int32_t imageHeight);
279  ASPOSE_PDF_SHARED_API void SaveAsTIFFClassF(System::SharedPtr<System::IO::Stream> outputStream, System::SharedPtr<PageSize> pageSize);
284  ASPOSE_PDF_SHARED_API void SaveAsTIFF(System::SharedPtr<System::IO::Stream> outputStream);
290  ASPOSE_PDF_SHARED_API void SaveAsTIFF(System::SharedPtr<System::IO::Stream> outputStream, Aspose::Pdf::Devices::CompressionType compressionType);
296  ASPOSE_PDF_SHARED_API void SaveAsTIFF(System::SharedPtr<System::IO::Stream> outputStream, System::SharedPtr<PageSize> pageSize);
303  ASPOSE_PDF_SHARED_API void SaveAsTIFF(System::SharedPtr<System::IO::Stream> outputStream, System::SharedPtr<PageSize> pageSize, System::SharedPtr<Aspose::Pdf::Devices::TiffSettings> settings);
310  ASPOSE_PDF_SHARED_API void SaveAsTIFF(System::SharedPtr<System::IO::Stream> outputStream, int32_t imageWidth, int32_t imageHeight);
318  ASPOSE_PDF_SHARED_API void SaveAsTIFF(System::SharedPtr<System::IO::Stream> outputStream, int32_t imageWidth, int32_t imageHeight, Aspose::Pdf::Devices::CompressionType compressionType);
326  ASPOSE_PDF_SHARED_API void SaveAsTIFF(System::SharedPtr<System::IO::Stream> outputStream, int32_t imageWidth, int32_t imageHeight, System::SharedPtr<Aspose::Pdf::Devices::TiffSettings> settings);
335  ASPOSE_PDF_SHARED_API void SaveAsTIFF(System::SharedPtr<System::IO::Stream> outputStream, int32_t imageWidth, int32_t imageHeight, System::SharedPtr<Aspose::Pdf::Devices::TiffSettings> settings, System::SharedPtr<IIndexBitmapConverter> converter);
340  ASPOSE_PDF_SHARED_API bool HasNextImage();
345  ASPOSE_PDF_SHARED_API void GetNextImage(System::String outputFile);
351  ASPOSE_PDF_SHARED_API void GetNextImage(System::String outputFile, System::SharedPtr<PageSize> pageSize);
359  ASPOSE_PDF_SHARED_API void GetNextImage(System::String outputFile, System::SharedPtr<System::Drawing::Imaging::ImageFormat> format);
366  ASPOSE_PDF_SHARED_API void GetNextImage(System::String outputFile, System::SharedPtr<PageSize> pageSize, System::SharedPtr<System::Drawing::Imaging::ImageFormat> format);
371  ASPOSE_PDF_SHARED_API void GetNextImage(System::SharedPtr<System::IO::Stream> outputStream);
377  ASPOSE_PDF_SHARED_API void GetNextImage(System::SharedPtr<System::IO::Stream> outputStream, System::SharedPtr<PageSize> pageSize);
383  ASPOSE_PDF_SHARED_API void GetNextImage(System::SharedPtr<System::IO::Stream> outputStream, System::SharedPtr<System::Drawing::Imaging::ImageFormat> format);
390  ASPOSE_PDF_SHARED_API void GetNextImage(System::SharedPtr<System::IO::Stream> outputStream, System::SharedPtr<PageSize> pageSize, System::SharedPtr<System::Drawing::Imaging::ImageFormat> format);
401  ASPOSE_PDF_SHARED_API void GetNextImage(System::String outputFile, System::SharedPtr<System::Drawing::Imaging::ImageFormat> format, int32_t imageWidth, int32_t imageHeight, int32_t quality);
410  ASPOSE_PDF_SHARED_API void GetNextImage(System::SharedPtr<System::IO::Stream> outputStream, System::SharedPtr<System::Drawing::Imaging::ImageFormat> format, int32_t imageWidth, int32_t imageHeight, int32_t quality);
421  ASPOSE_PDF_SHARED_API void GetNextImage(System::String outputFile, System::SharedPtr<System::Drawing::Imaging::ImageFormat> format, double imageWidth, double imageHeight, int32_t quality);
430  ASPOSE_PDF_SHARED_API void GetNextImage(System::SharedPtr<System::IO::Stream> outputStream, System::SharedPtr<System::Drawing::Imaging::ImageFormat> format, double imageWidth, double imageHeight, int32_t quality);
435  ASPOSE_PDF_SHARED_API void BindPdf(System::String inputFile) override;
440  ASPOSE_PDF_SHARED_API void BindPdf(System::SharedPtr<System::IO::Stream> inputStream) override;
441 
445  ASPOSE_PDF_SHARED_API PdfConverter();
452  ASPOSE_PDF_SHARED_API PdfConverter(System::SharedPtr<Aspose::Pdf::Document> document);
453 
457  ASPOSE_PDF_SHARED_API void Close() override;
464  ASPOSE_PDF_SHARED_API void SaveAsTIFFClassF(System::String outputFile);
469  ASPOSE_PDF_SHARED_API void SaveAsTIFFClassF(System::SharedPtr<System::IO::Stream> outputStream);
475  ASPOSE_PDF_SHARED_API void SaveAsTIFF(System::String outputFile, System::SharedPtr<Aspose::Pdf::Devices::TiffSettings> settings);
482  ASPOSE_PDF_SHARED_API void SaveAsTIFF(System::String outputFile, System::SharedPtr<Aspose::Pdf::Devices::TiffSettings> settings, System::SharedPtr<IIndexBitmapConverter> converter);
488  ASPOSE_PDF_SHARED_API void SaveAsTIFF(System::SharedPtr<System::IO::Stream> outputStream, System::SharedPtr<Aspose::Pdf::Devices::TiffSettings> settings);
505  ASPOSE_PDF_SHARED_API void GetNextImage(System::String outputFile, System::SharedPtr<System::Drawing::Imaging::ImageFormat> format, int32_t imageWidth, int32_t imageHeight);
513  ASPOSE_PDF_SHARED_API void GetNextImage(System::SharedPtr<System::IO::Stream> outputStream, System::SharedPtr<System::Drawing::Imaging::ImageFormat> format, int32_t imageWidth, int32_t imageHeight);
520  ASPOSE_PDF_SHARED_API void GetNextImage(System::SharedPtr<System::IO::Stream> outputStream, System::SharedPtr<System::Drawing::Imaging::ImageFormat> format, int32_t quality);
528  ASPOSE_PDF_SHARED_API void GetNextImage(System::SharedPtr<System::IO::Stream> outputStream, System::SharedPtr<PageSize> pageSize, System::SharedPtr<System::Drawing::Imaging::ImageFormat> format, int32_t quality);
535  ASPOSE_PDF_SHARED_API void GetNextImage(System::String outputFile, System::SharedPtr<System::Drawing::Imaging::ImageFormat> format, int32_t quality);
543  ASPOSE_PDF_SHARED_API void GetNextImage(System::String outputFile, System::SharedPtr<PageSize> pageSize, System::SharedPtr<System::Drawing::Imaging::ImageFormat> format, int32_t quality);
560 
561 protected:
562 
569  void GetNextImage(System::SharedPtr<System::IO::Stream> outputStream, System::SharedPtr<System::Drawing::Imaging::ImageFormat> format, bool asGrayscale);
570  System::SharedPtr<System::IO::MemoryStream> ConvertPageToPNGMemoryStream(System::SharedPtr<Page> page);
571  System::ArrayPtr<uint8_t> ConvertPageToPNGByteArray(System::SharedPtr<Page> page);
575  void GetNextImage(System::SharedPtr<System::Drawing::Graphics> outGraphics, float leftTopX, float leftTopY, int32_t paperWidth, int32_t paperHeight, System::Drawing::Rectangle marginBounds, float scaleFactor, int32_t rotateDegrees, bool autoSize, VerticalAlignment verticalAlignment, HorizontalAlignment horizontalAlignment, bool isXPSPrinting, bool isIntermidiateImage, bool isGrayscale);
576 
577 private:
578 
580  int32_t _startPage;
581  int32_t _endPage;
582  int32_t _currentPage;
583  System::String _password;
584  System::String _userPassword;
585  Aspose::Pdf::Devices::FormPresentationMode _formPresentationMode;
586  bool _convertFontsToUnicodeTTF;
591  bool _showHiddenAreas;
592  bool _showHiddenAreasExplicitlySet;
593  PageCoordinateType _coordinateType;
594 
596  System::SharedPtr<Aspose::Pdf::Devices::ImageDevice> CreateGraphicsDevice(float leftTopX, float leftTopY, int32_t paperWidth, int32_t paperHeight, System::Drawing::Rectangle marginBounds, float scaleFactor, System::SharedPtr<Aspose::Pdf::Devices::Resolution> resolution, int32_t rotateDegrees, bool autoSize, VerticalAlignment verticalAlignment, HorizontalAlignment horizontalAlignment, bool isXpsPrinting);
597  System::SharedPtr<Aspose::Pdf::Devices::ImageDevice> CreateNonTiffDevice(System::SharedPtr<System::Drawing::Imaging::ImageFormat> format, int32_t imageWidth, int32_t imageHeight, System::SharedPtr<Aspose::Pdf::Devices::Resolution> resolution, int32_t quality);
603  void ConvertDynamicXfa();
604 
605 };
606 
607 } // namespace Facades
608 } // namespace Pdf
609 } // namespace Aspose
610 
611 
VerticalAlignment
Enumeration of possible vertical alignment values.
Definition: VerticalAlignment.h:16
String class used across the library. Is a substitute for C# System.String when translating code...
Definition: string.h:121
class ASPOSECPP_SHARED_CLASS List
Definition: ienumerable.h:17
Class representing PDF document
Definition: Document.h:625
Definition: Artifact.h:67
Base facade class.
Definition: Facade.h:57
ImageMergeMode
Represents modes for merging images.
Definition: ImageMergeMode.h:13
Represents a rectangular area of an image defined as integer X and Y coordinates of its upper left co...
Definition: rectangle.h:18
PageCoordinateType
Describes page coordinate type.
Definition: PageCoordinateType.h:11
HorizontalAlignment
Describes horizontal alignment.
Definition: HorizontalAlignment.h:16
Definition: signed_info.h:13
Represents a class to convert a pdf file&#39;s each page to images, supporting BMP, JPEG, PNG and TIFF now. Supported content in pdfs: pictures, form, comment.
Definition: PdfConverter.h:94
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
FormPresentationMode
Used to specify the form presentation mode when printing or converting to image pdf documents...
Definition: FormPresentationMode.h:13
Definition: AFRelationship.h:4
List forward declaration.
Definition: Artifact.h:74
The coordinates are in the page coordinate context.
ImageFormat
This enum represents image formats.
Definition: ImageFormat.h:13
CompressionType
Used to specify the parameter value passed to a Tiff image device.
Definition: CompressionType.h:18
Whole PDF file will be submitted.
Represents the file format of an image. Objects of this class should only be allocated using System::...
Definition: image_format.h:18