Loading...
Searching...
No Matches
PDFNet.h
Go to the documentation of this file.
1//---------------------------------------------------------------------------------------
2// Copyright (c) 2001-2025 by Apryse Software Inc. All Rights Reserved.
3// Consult legal.txt regarding legal and license information.
4//---------------------------------------------------------------------------------------
5#ifndef PDFTRON_H_CPPPDFPDFNet
6#define PDFTRON_H_CPPPDFPDFNet
7
8#include <C/PDF/TRN_PDFNet.h>
9#include <Common/UString.h>
10#include <Common/Iterator.h>
11#include <Filters/Filter.h>
12#ifdef SWIG
13#include <PDF/Callback.h>
14#endif
15 namespace pdftron {
16
24 class PDFNet
25{
26 public:
27
41 static void Initialize(const char* license_key = 0);
42
43#ifdef SWIG
56 static void Initialize(const char* license_key, const char* json_string);
57#endif
58
68 static void Terminate(const int termination_level);
69
75 static void EnableJavaScript(bool enable);
76
82 static bool IsJavaScriptEnabled();
83
84//#ifndef SWIG
92 static void Terminate();
93//#endif
94
109 static bool SetResourcesPath(const UString& path);
110
115 static UString GetResourcesPath();
116
127 static void AddResourceSearchPath(const UString& path);
128
132 static double GetVersion();
133
134 enum CMSType
135 {
136 e_lcms,
137 e_icm,
138 e_no_cms
139 };
140
147 static void SetColorManagement(CMSType t = e_lcms);
148
159 static void SetDefaultDeviceCMYKProfile(const UString& icc_filename);
160
171 static void SetDefaultDeviceCMYKProfile(Filters::Filter stream);
172
173
184 static void SetDefaultDeviceRGBProfile(const UString& icc_filename);
185
196 static void SetDefaultDeviceRGBProfile(Filters::Filter stream);
197
204 static void SetDefaultDiskCachingEnabled( bool use_disk );
205
206 enum FlateCompressionLevel
207 {
208 e_Z_DEFAULT_COMPRESSION = -1,
209 e_Z_NO_COMPRESSION = 0,
210 e_Z_BEST_SPEED = 1,
211 e_Z_BEST_COMPRESSION = 9
212 };
213
225 static void SetDefaultFlateCompressionLevel(int level);
226
237 static void SetViewerCache(size_t max_cache_size, bool on_disk);
238
244 enum CharacterOrdering {
245 e_Identity = 0,
246 e_Japan1 = 1,
247 e_Japan2 = 2,
248 e_GB1 = 3,
249 e_CNS1 = 4,
250 e_Korea1 = 5
251 };
252
280 static bool AddFontSubst(const char* fontname, const UString& fontpath);
314 static bool AddFontSubst(CharacterOrdering ordering, const UString& fontpath);
315
322 static void SetTempPath(const UString& temp_path);
323
330 static void SetPersistentCachePath(const UString& persistent_path);
331
337 static UString GetSystemFontList();
338
339#ifndef SWIG
345 typedef TRN_PDFNetCreateSecurityHandler CreateSecurityHandler;
346
355 static void RegisterSecurityHandler(const char* handler_name, const char* gui_name, CreateSecurityHandler factory_method);
356
360 class SecurityDescriptor : public TRN_SecHdlrInfo {
361 public:
362 const char* GetName() { return m_name; }
363 const char* GetGuiName() { return m_gui_name; }
364 CreateSecurityHandler GetCreateFunct() { return m_factory_method; }
365 };
366
367 typedef Common::Iterator<SecurityDescriptor> SecurityDescriptorIterator;
368
373 static SecurityDescriptorIterator GetSecHdlrInfoIterator();
374
387 static void SetNumberWriteProc(char* (*WriteProc) (double num, char *in_buf, int in_buf_size));
388
397 static void SetNumberReadProc(TRN_Bool (*ReadProc) (const TRN_UChar *buf, double *output));
398#endif
399
401 typedef enum _LogLevel
402 {
403 e_LogLevel_Off = -1,
404 e_LogLevel_Fatal = 5,
405 e_LogLevel_Error = 4,
406 e_LogLevel_Warning = 3,
407 e_LogLevel_Info = 2,
408 e_LogLevel_Trace = 1,
409 e_LogLevel_Debug = 0
410 }
411 LogLevel;
412
413 static void SetLogLevel(LogLevel level = e_LogLevel_Fatal);
415
422 static void AddPDFTronCustomHandler(UInt32 custom_id);
423
427 static const char* GetVersionString();
428
435 static void SetWriteAPIUsageLocally(bool write_usage);
436
437 enum ConnectionErrorHandlingMode
438 {
439 e_continue, // Apryse SDK will continue running and if necessary switch to demo mode when encountering an unresolvable connection error
440 e_continue_unless_switching_to_demo, // Apryse SDK will continue as long as it doesn't need to switch to demo mode in response to the connection error
441 // If continuing without switching to demo mode is not possible, Apryse SDK functions will throw exceptions.
442 e_stop // Apryse SDK will throw exceptions from subsequent usage if a connection error occurs
443 };
444
451 static void SetConnectionErrorHandlingMode(ConnectionErrorHandlingMode mode);
452
464 typedef void(*ConnectionErrorProc) (const char* message, const int error_code, UChar switch_to_demo, void* user_data);
465
473#ifdef SWIG
474 static void SetConnectionErrorProc(PDF::Callback* instance);
475#else
476 static void SetConnectionErrorProc(ConnectionErrorProc error_proc, void* data);
477#endif
478
479};
480
481
482
483#include <Impl/PDFNet.inl>
484
485}; // namespace pdftron
486
487#endif // PDFTRON_H_CPPPDFPDFNet
Callback.h
Filter.h
Iterator.h
UString.h
pdftron::Common::Iterator
Definition Iterator.h:21
pdftron::Filters::Filter
Definition Filter.h:46
pdftron::PDFNet::SecurityDescriptor
Definition PDFNet.h:360
pdftron::PDFNet::SecurityDescriptor::GetGuiName
const char * GetGuiName()
Definition PDFNet.h:363
pdftron::PDFNet::SecurityDescriptor::GetName
const char * GetName()
Definition PDFNet.h:362
pdftron::PDFNet::SecurityDescriptor::GetCreateFunct
CreateSecurityHandler GetCreateFunct()
Definition PDFNet.h:364
pdftron::PDFNet
Definition PDFNet.h:25
pdftron::PDFNet::SetDefaultFlateCompressionLevel
static void SetDefaultFlateCompressionLevel(int level)
pdftron::PDFNet::GetSecHdlrInfoIterator
static SecurityDescriptorIterator GetSecHdlrInfoIterator()
pdftron::PDFNet::SetTempPath
static void SetTempPath(const UString &temp_path)
pdftron::PDFNet::CMSType
CMSType
Definition PDFNet.h:135
pdftron::PDFNet::e_icm
@ e_icm
Use Windows ICM2 (available only on Windows platforms).
Definition PDFNet.h:137
pdftron::PDFNet::e_lcms
@ e_lcms
Use LittleCMS (available on all supported platforms).
Definition PDFNet.h:136
pdftron::PDFNet::e_no_cms
@ e_no_cms
No ICC color management.
Definition PDFNet.h:138
pdftron::PDFNet::SetConnectionErrorProc
static void SetConnectionErrorProc(ConnectionErrorProc error_proc, void *data)
pdftron::PDFNet::SetDefaultDiskCachingEnabled
static void SetDefaultDiskCachingEnabled(bool use_disk)
pdftron::PDFNet::SetConnectionErrorHandlingMode
static void SetConnectionErrorHandlingMode(ConnectionErrorHandlingMode mode)
pdftron::PDFNet::GetVersionString
static const char * GetVersionString()
pdftron::PDFNet::SetDefaultDeviceCMYKProfile
static void SetDefaultDeviceCMYKProfile(Filters::Filter stream)
pdftron::PDFNet::AddFontSubst
static bool AddFontSubst(CharacterOrdering ordering, const UString &fontpath)
pdftron::PDFNet::AddPDFTronCustomHandler
static void AddPDFTronCustomHandler(UInt32 custom_id)
pdftron::PDFNet::EnableJavaScript
static void EnableJavaScript(bool enable)
pdftron::PDFNet::SetResourcesPath
static bool SetResourcesPath(const UString &path)
pdftron::PDFNet::CreateSecurityHandler
TRN_PDFNetCreateSecurityHandler CreateSecurityHandler
Definition PDFNet.h:345
pdftron::PDFNet::SetDefaultDeviceRGBProfile
static void SetDefaultDeviceRGBProfile(Filters::Filter stream)
pdftron::PDFNet::SetColorManagement
static void SetColorManagement(CMSType t=e_lcms)
pdftron::PDFNet::Initialize
static void Initialize(const char *license_key=0)
pdftron::PDFNet::ConnectionErrorHandlingMode
ConnectionErrorHandlingMode
Definition PDFNet.h:438
pdftron::PDFNet::e_continue_unless_switching_to_demo
@ e_continue_unless_switching_to_demo
Definition PDFNet.h:440
pdftron::PDFNet::e_stop
@ e_stop
Definition PDFNet.h:442
pdftron::PDFNet::e_continue
@ e_continue
Definition PDFNet.h:439
pdftron::PDFNet::SetViewerCache
static void SetViewerCache(size_t max_cache_size, bool on_disk)
pdftron::PDFNet::SetWriteAPIUsageLocally
static void SetWriteAPIUsageLocally(bool write_usage)
pdftron::PDFNet::SetPersistentCachePath
static void SetPersistentCachePath(const UString &persistent_path)
pdftron::PDFNet::RegisterSecurityHandler
static void RegisterSecurityHandler(const char *handler_name, const char *gui_name, CreateSecurityHandler factory_method)
pdftron::PDFNet::SetDefaultDeviceCMYKProfile
static void SetDefaultDeviceCMYKProfile(const UString &icc_filename)
pdftron::PDFNet::SetNumberWriteProc
static void SetNumberWriteProc(char *(*WriteProc)(double num, char *in_buf, int in_buf_size))
pdftron::PDFNet::Terminate
static void Terminate(const int termination_level)
pdftron::PDFNet::GetSystemFontList
static UString GetSystemFontList()
pdftron::PDFNet::ConnectionErrorProc
void(* ConnectionErrorProc)(const char *message, const int error_code, UChar switch_to_demo, void *user_data)
Definition PDFNet.h:464
pdftron::PDFNet::GetResourcesPath
static UString GetResourcesPath()
pdftron::PDFNet::AddFontSubst
static bool AddFontSubst(const char *fontname, const UString &fontpath)
pdftron::PDFNet::SetNumberReadProc
static void SetNumberReadProc(TRN_Bool(*ReadProc)(const TRN_UChar *buf, double *output))
pdftron::PDFNet::CharacterOrdering
CharacterOrdering
Definition PDFNet.h:244
pdftron::PDFNet::e_Identity
@ e_Identity
Generic/Unicode.
Definition PDFNet.h:245
pdftron::PDFNet::e_Korea1
@ e_Korea1
Korean.
Definition PDFNet.h:250
pdftron::PDFNet::e_Japan1
@ e_Japan1
Japanese.
Definition PDFNet.h:246
pdftron::PDFNet::e_GB1
@ e_GB1
Chinese; Simplified.
Definition PDFNet.h:248
pdftron::PDFNet::e_Japan2
@ e_Japan2
Japanese.
Definition PDFNet.h:247
pdftron::PDFNet::e_CNS1
@ e_CNS1
Chinese; Traditional.
Definition PDFNet.h:249
pdftron::PDFNet::SetDefaultDeviceRGBProfile
static void SetDefaultDeviceRGBProfile(const UString &icc_filename)
pdftron::PDFNet::IsJavaScriptEnabled
static bool IsJavaScriptEnabled()
pdftron::PDFNet::Terminate
static void Terminate()
pdftron::PDFNet::GetVersion
static double GetVersion()
pdftron::PDFNet::FlateCompressionLevel
FlateCompressionLevel
Definition PDFNet.h:207
pdftron::PDFNet::e_Z_DEFAULT_COMPRESSION
@ e_Z_DEFAULT_COMPRESSION
Definition PDFNet.h:208
pdftron::PDFNet::e_Z_NO_COMPRESSION
@ e_Z_NO_COMPRESSION
Definition PDFNet.h:209
pdftron::PDFNet::e_Z_BEST_COMPRESSION
@ e_Z_BEST_COMPRESSION
Definition PDFNet.h:211
pdftron::PDFNet::e_Z_BEST_SPEED
@ e_Z_BEST_SPEED
Definition PDFNet.h:210
pdftron::PDFNet::SecurityDescriptorIterator
Common::Iterator< SecurityDescriptor > SecurityDescriptorIterator
Definition PDFNet.h:367
pdftron::PDFNet::AddResourceSearchPath
static void AddResourceSearchPath(const UString &path)
pdftron::UString
Definition UString.h:28
pdftron
Definition BasicTypes.h:10
pdftron::UInt32
TRN_UInt32 UInt32
Definition BasicTypes.h:13
pdftron::UChar
TRN_UChar UChar
Definition BasicTypes.h:12