LoadOptions.h
1 #pragma once
2 // Copyright (c) 2001-2024 Aspose Pty Ltd. All Rights Reserved.
3 
4 #include <system/multicast_delegate.h>
5 #include <system/exceptions.h>
6 #include <system/enum_helpers.h>
7 #include <system/array.h>
8 #include <cstdint>
9 
10 #include "Aspose.PDF.Cpp/aspose_pdf_api_defs.h"
11 
12 namespace Aspose
13 {
14 namespace Pdf
15 {
16 enum class ApsToXpsSavingMode;
17 class ApsUsingConverter;
18 class Document;
19 class HtmlFragment;
20 enum class LoadFormat;
21 class Page;
22 namespace Tests
23 {
24 namespace HTML
25 {
26 class Pdf2HtmlConverterTests;
27 class Pdf2HtmlTestUtils;
28 } // namespace HTML
29 class PclImportTests;
30 class RegressionTests_v18_9;
31 class RegressionTests_v19_12;
32 class RegressionTests_v8_5;
33 class TestBase;
34 } // namespace Tests
35 class TeXFragment;
36 class TeXToPdfConverter;
37 enum class UsageMode;
38 } // namespace Pdf
39 } // namespace Aspose
40 namespace System
41 {
42 namespace Text
43 {
44 class Encoding;
45 } // namespace Text
46 } // namespace System
47 
48 namespace Aspose {
49 
50 namespace Pdf {
51 
55 enum class WarningType
56 {
64  DataLoss = 1,
85 };
86 
88 DECLARE_USING_GLOBAL_OPERATORS
89 
94 enum class ReturnAction
95 {
99  Continue,
103  Abort
104 };
105 
107 DECLARE_USING_GLOBAL_OPERATORS
108 
112 class ASPOSE_PDF_SHARED_CLASS WarningInfo final : public System::Object
113 {
114  typedef WarningInfo ThisType;
115  typedef System::Object BaseType;
116 
117  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
118  ASPOSE_PDF_SHARED_RTTI_INFO_DECL();
119 
120 public:
121 
128  ASPOSE_PDF_SHARED_API System::String get_WarningMessage() const;
135  ASPOSE_PDF_SHARED_API WarningType get_WarningTypeProperty() const;
136 
146  ASPOSE_PDF_SHARED_API WarningInfo(WarningType type, System::String message);
147 
148 private:
149 
153  System::String warningMessage;
157  WarningType warningType;
158 
159 };
160 
164 class ASPOSE_PDF_SHARED_CLASS IWarningCallback : public virtual System::Object
165 {
166  typedef IWarningCallback ThisType;
167  typedef System::Object BaseType;
168 
169  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
170  ASPOSE_PDF_SHARED_RTTI_INFO_DECL();
171 
172 public:
173 
183  virtual ReturnAction Warning(System::SharedPtr<WarningInfo> warning) = 0;
184 
185 };
186 
190 class ASPOSE_PDF_SHARED_CLASS LoadOptions : public virtual System::Object
191 {
192  typedef LoadOptions ThisType;
193  typedef System::Object BaseType;
194 
195  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
196  ASPOSE_PDF_SHARED_RTTI_INFO_DECL();
197 
200  friend class Aspose::Pdf::ApsUsingConverter;
201  friend class Aspose::Pdf::Document;
202  friend class Aspose::Pdf::TeXToPdfConverter;
203  friend class Aspose::Pdf::Tests::HTML::Pdf2HtmlTestUtils;
204  friend class Aspose::Pdf::Tests::TestBase;
205  friend class Aspose::Pdf::Tests::RegressionTests_v18_9;
206  friend class Aspose::Pdf::Tests::PclImportTests;
207  friend class Aspose::Pdf::Tests::RegressionTests_v8_5;
208  friend class Aspose::Pdf::Tests::RegressionTests_v19_12;
209  friend class Aspose::Pdf::Tests::HTML::Pdf2HtmlConverterTests;
210 
211 public:
212 
219  {
225  PutContentOnMarginAreaIfNecessary = 0,
231  NeverPutContentOnMarginArea = 1
232  };
233 
247  {
252  NoAjustmentAllwaysUsePredefinedSize = 0,
260  EnlargeRequiredViewportWidthAndDoConversionAgain = 1
261  };
262 
263 
264 public:
265 
275  class ResourceLoadingResult;
276  using ResourceLoadingStrategy = System::MulticastDelegate<System::SharedPtr<LoadOptions::ResourceLoadingResult>(System::String)>;
277 
278 
279 public:
280 
284  class ASPOSE_PDF_SHARED_CLASS ResourceLoadingResult : public System::Object
285  {
286  typedef ResourceLoadingResult ThisType;
287  typedef System::Object BaseType;
288 
289  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
290  ASPOSE_PDF_SHARED_RTTI_INFO_DECL();
291 
292  public:
293 
297  ASPOSE_PDF_SHARED_API System::ArrayPtr<uint8_t> get_Data() const;
298 
325 
330  ASPOSE_PDF_SHARED_API ResourceLoadingResult(System::ArrayPtr<uint8_t> data);
331 
332  protected:
333 
335 
336  MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(ResourceLoadingResult, CODEPORTING_ARGS(System::ArrayPtr<uint8_t> data, System::SharedPtr<System::Text::Encoding> enc));
337 
338  private:
339 
340  System::ArrayPtr<uint8_t> _fetchedData;
341 
342  };
343 
344 
345 public:
346 
352  ASPOSE_PDF_SHARED_API System::SharedPtr<IWarningCallback> get_WarningHandler() const;
358  ASPOSE_PDF_SHARED_API void set_WarningHandler(System::SharedPtr<IWarningCallback> value);
362  ASPOSE_PDF_SHARED_API Aspose::Pdf::LoadFormat get_LoadFormat() const;
377  ASPOSE_PDF_SHARED_API bool get_DisableFontLicenseVerifications() const;
392  ASPOSE_PDF_SHARED_API void set_DisableFontLicenseVerifications(bool value);
393 
394  ASPOSE_PDF_SHARED_API LoadOptions();
395 
396 protected:
397 
398  static const int32_t DefaultBatchSize;
400  UsageMode _usageMode;
404  ApsToXpsSavingMode ApsAsXpsSavingType;
412 
413 private:
414 
415  System::SharedPtr<IWarningCallback> _warningHandler;
416  bool pr_DisableFontLicenseVerifications;
417 
418 };
419 
420 } // namespace Pdf
421 } // namespace Aspose
422 
423 DECLARE_USING_ENUM_OPERATORS(Aspose::Pdf);
424 
425 
426 
System::MulticastDelegate< System::SharedPtr< LoadOptions::ResourceLoadingResult >(System::String)> ResourceLoadingStrategy
Definition: LoadOptions.h:276
UsageMode _usageMode
Definition: LoadOptions.h:400
System::String PlainApsIntermediateTempFileIfAny
Sometimes we need use temp file to save APS during conversion to avoid OOM exceptions in PalZipWriter...
Definition: LoadOptions.h:409
bool LoadingCancelled
Sometimes for some reasons loading should not occure custom code. In such case please set this flag a...
Definition: LoadOptions.h:324
System::String MIMETypeIfKnown
Sometimes knowledge about MIME type of loaded resource is usefull for converter You can provide MIME ...
Definition: LoadOptions.h:318
String class used across the library. Is a substitute for C# System.String when translating code...
Definition: string.h:121
Immutable object for encapsulating warning information.
Definition: LoadOptions.h:112
Interface for user&#39;s callback mechanism support.
Definition: LoadOptions.h:164
Base class that enables using methods available for System.Object class in C#. All non-trivial classe...
Definition: object.h:64
Class representing PDF document
Definition: Document.h:616
Definition: Artifact.h:67
System::SharedPtr< Aspose::Pdf::Page > Page
Definition: LoadOptions.h:411
System::SharedPtr< System::Text::Encoding > EncodingIfKnown
Sometimes encoding of resource is known after or during loading. In such case custom code can provide...
Definition: LoadOptions.h:304
WarningType
Enum represented warning type.
Definition: LoadOptions.h:55
Template that represents wrapper of exceptions that are derived from Exception class.
Definition: exception.h:28
Represents html fragment.
Definition: HtmlFragment.h:48
static const int32_t DefaultBatchSize
Definition: LoadOptions.h:398
ApsToXpsSavingMode ApsAsXpsSavingType
Definition: LoadOptions.h:404
System::String ApsIntermediateFileIfAny
Definition: LoadOptions.h:401
bool UseAreaClipping
Definition: LoadOptions.h:410
ReturnAction
Enum represented a program workflow action in case of invoking the IWarningCallback::Warning(Aspose::...
Definition: LoadOptions.h:94
Definition: signed_info.h:13
Definition: AFRelationship.h:6
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: fwd.h:22
Minor formatting losses compared to the original document. This is for minor losses of fidelity...
Aspose::Pdf::LoadFormat _loadFormat
Definition: LoadOptions.h:399
Used for continue flow.
DECLARE_ENUM_OPERATORS(Aspose::Pdf::WarningType)
Result of custom loading of resource
Definition: LoadOptions.h:284
Definition: AFRelationship.h:4
LoadFormat
Specifies load format.
Definition: LoadFormat.h:16
System::Exception ExceptionOfLoadingIfAny
Sometimes it&#39;s impossible to load requested resource for some reason. Unavailability of resource ofte...
Definition: LoadOptions.h:312
means loading of document in HTML format
The coordinates are in the page coordinate context.
Major formatting losses compared to the original document. This is for occasions when the formatting ...
Known issue that will prevent the document being opened by certain user agents, or previous versions ...
The file has unexpected content.
means saving without change of format, i.e. as PDF use it please instead of &#39;SaveFormat.None&#39;, that is obsolete one
PageSizeAdjustmentModes
ATTENTION! The feature implemented but did not put yet to public API since blocker issue in OSHARED l...
Definition: LoadOptions.h:246
System::String PngIntermediateFileIfAny
Definition: LoadOptions.h:403
Represents TeX fragment.
Definition: TeXFragment.h:53
MarginsAreaUsageModes
Represents mode of usage of margins area during conversion (like HTML, EPUB etc), defines treatement ...
Definition: LoadOptions.h:218
Text/chart/image or other data is completely missing from either the documet tree following load...
Whole PDF file will be submitted.
System::String XpsIntermediateFileIfAny
Definition: LoadOptions.h:402
LoadOptions type holds level of abstraction on individual load options
Definition: LoadOptions.h:190