Foxit PDF SDK
fs_compliancecommon.h
Go to the documentation of this file.
1 
15 #ifndef FS_COMPLIANCEENGINE_H_
16 #define FS_COMPLIANCEENGINE_H_
17 
18 #include "common/fs_common.h"
19 
25 namespace foxit {
29 namespace addon {
33 namespace compliance {
34 class ResultInformation;
35 class ProgressCallback;
38 class Preflight;
39 
49 class ComplianceEngine FS_FINAL : public Object{
50  public:
56  typedef enum _ViewOrPrintCondition {
68 
69 
102  static ErrorCode Initialize(const wchar_t* compliance_resource_folder_path, const char* compliance_engine_unlockcode);
103 
112  static void Release();
113 
114 #if !defined(_MAC_JAVA_)
115 
137 
147  static void ReleaseThreadContext();
148 #endif
149 
161  static void SetTempFolderPath(const wchar_t* temp_folder_path);
162 
172  static void EnableHandleTransparency(bool enable_handle_transparency);
173 
190  static void SetLanguage(const char* language);
191 };
192 
198  public:
204  virtual void Release() = 0;
205 
214  virtual void UpdateCurrentStateData(int current_rate, const WString& current_state_string) = 0;
215 
216  protected:
217  ~ProgressCallback() {}
218 };
219 
221 class PreflightSettingData FS_FINAL : public Object{
222  public:
228  typedef enum _LibraryType {
235  } LibraryType;
236 
242  typedef enum _OperateType {
249  } OperateType;
250 
251 
254  : preflight_key(L"")
256  , src_pdf_path(L"")
257  , saved_pdf_path(L"")
258  , first_page_index(0)
259  , last_page_index(-1) {}
260 
278  this->preflight_key = preflight_key;
279  this->operate_type = operate_type;
280  this->src_pdf_path = src_pdf_path;
281  this->saved_pdf_path = saved_pdf_path;
282  this->first_page_index = first_page_index;
283  this->last_page_index = last_page_index;
284  }
285 
295  operate_type = data.operate_type;
296  src_pdf_path = data.src_pdf_path;
300  return (*this);
301  }
302 
305 
312 
315 
318 
321 
328 };
329 
331 class PreflightReportSettingData FS_FINAL : public Object{
332  public:
338  typedef enum _ReportFileFormatType {
348 
354  typedef enum _ProblemsHighlightMethod {
360 
361 
365  , to_generate_overview(true)
366  , to_highlight_problems(true)
368  , report_file_path(L"") {}
369 
386  ProblemsHighlightMethod problem_highlight_method, const wchar_t* report_file_path) {
387  this->report_file_format_type = report_file_format_type;
388  this->to_generate_overview = to_generate_overview;
389  this->to_highlight_problems = to_highlight_problems;
390  this->problems_highlight_method = problem_highlight_method;
391  this->report_file_path = report_file_path;
392  }
393 
407  return (*this);
408  }
409 
415 
418 
421 
428 
431 };
432 
436 class Preflight FS_FINAL : public Base {
437  public:
439  Preflight();
440 
441  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
442  explicit Preflight(FS_HANDLE handle);
443 
445  ~Preflight();
446 
452  Preflight(const Preflight& other);
453 
461  Preflight& operator = (const Preflight& other);
462 
470  bool operator == (const Preflight& other) const;
471 
479  bool operator != (const Preflight& other) const;
480 
488  bool IsEmpty() const;
489 
501 
509  StringArray GetItemKeysArray(const String& group_name);
510 
519  void Analyze(const PreflightSettingData& preflight_setting_data, ProgressCallback* progress_callback = NULL);
520 
529  void AnalyzeAndFixup(const PreflightSettingData& preflight_setting_data, ProgressCallback* progress_callback = NULL);
530 
539  bool GenerateReport(const PreflightReportSettingData& preflight_report_setting_data, ProgressCallback* progress_callback = NULL);
540 
548  bool CanFixup(const String& item_key);
549 };
550 
554 class FixupData : public Object {
555  public:
561  typedef enum _FixupState {
568  } FixupState;
569 
570 
573  : used_count(0)
575 
581  FixupData(const FixupData& other)
582  : used_count(other.used_count)
583  , state(other.state)
584  , name(other.name)
585  , comment(other.comment)
586  , reasons(other.reasons) {}
587 
595  FixupData& operator = (const FixupData& other) {
596  used_count = other.used_count;
597  state = other.state;
598  name = other.name;
599  comment = other.comment;
600  reasons = other.reasons;
601  return *this;
602  }
603 
611  bool operator == (const FixupData& other) const {
612  bool is_equal = (used_count == other.used_count && state == other.state &&
613  name == other.name && comment == other.comment);
614  if (is_equal) {
615  for (int i=0; i<(int)reasons.GetSize(); i++) {
616  if (reasons[i] != other.reasons[i]) {
617  is_equal = false;
618  break;
619  }
620  }
621  }
622  return is_equal;
623  }
624 
632  bool operator != (const FixupData& other) const {
633  return !((*this) == other);
634  }
635 
649 };
650 
654 class HitData : public Object {
655  public:
661  typedef enum _CheckSeverity {
668  } CheckSeverity;
669 
670 
673  : triggered_count(0)
675  , page_index(-1){}
676 
682  HitData(const HitData& other)
684  , severity(other.severity)
685  , name(other.name)
686  , comment(other.comment)
688  , page_index(other.page_index) {}
689 
697  HitData& operator = (const HitData& other) {
699  severity = other.severity;
700  name = other.name;
701  comment = other.comment;
703  page_index = other.page_index;
704  return *this;
705  }
706 
714  bool operator == (const HitData& other) const {
715  bool is_equal = (triggered_count == other.triggered_count && severity == other.severity &&
716  name == other.name && comment == other.comment && page_index == other.page_index);
717  if (is_equal) {
718  for (int i=0; i<(int)trigger_values.GetSize(); i++) {
719  if (trigger_values[i] != other.trigger_values[i]) {
720  is_equal = false;
721  break;
722  }
723  }
724  }
725  return is_equal;
726  }
727 
735  bool operator != (const HitData& other) const {
736  return !((*this) == other);
737  }
738 
754 };
755 
760 class ResultInformation FS_FINAL : public Base {
761  public:
764  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
765  explicit ResultInformation(FS_HANDLE handle);
773  ResultInformation(const ResultInformation& other);
774 
790  bool operator == (const ResultInformation& other) const;
791 
799  bool operator != (const ResultInformation& other) const;
800 
808  bool IsEmpty() const;
809 
815  int GetFixupDataCount() const;
824  FixupData GetFixupData(int index) const;
825 
831  int GetHitDataCount() const;
832 
841  HitData GetHitData(int index) const;
842 };
843 } // namespace compliance/**
844 } // namespace addon
845 } // namespace foxit
846 
847 #endif // FS_COMPLIANCEENGINE_H_
virtual void Release()=0
A callback function used to release current callback object itself.
LibraryType
Enumeration for the preflight library type.
Definition: fs_compliancecommon.h:228
PreflightReportSettingData()
Constructor.
Definition: fs_compliancecommon.h:363
FixupData & operator=(const FixupData &other)
Assign operator.
Definition: fs_compliancecommon.h:595
Error severity.
Definition: fs_compliancecommon.h:667
Report file format type: XML.
Definition: fs_compliancecommon.h:342
bool operator !=(const HitData &other) const
Not equal operator.
Definition: fs_compliancecommon.h:735
int page_index
Page index, starting from 0. -1 means current hit data was hit in document level.
Definition: fs_compliancecommon.h:753
bool to_generate_overview
Whether to generate overview or not. true menas to generate overview, false means not.
Definition: fs_compliancecommon.h:417
CFX_Object Object
Object type.
Definition: fs_basictypes.h:221
Preflight library type: Foxit.
Definition: fs_compliancecommon.h:230
HitData GetHitData(int index) const
Get a hit data.
int first_page_index
Index of the first page to be analyzed or fixed, staring from 0. Default value: 0.
Definition: fs_compliancecommon.h:320
bool CanFixup(const String &item_key)
Check whether the item key can be fixuped or not.
Definition: fs_basictypes.h:228
Definition: fs_compliancecommon.h:760
FixupData GetFixupData(int index) const
Get a fixup data.
uint32 triggered_count
Represents the count of hit operation for current data has been triggered during document verificatio...
Definition: fs_compliancecommon.h:740
ReportFileFormatType
Enumeration for the preflight report file format type.
Definition: fs_compliancecommon.h:338
FixupData()
Constructor.
Definition: fs_compliancecommon.h:572
A fixup succeeded.
Definition: fs_compliancecommon.h:563
StringArray GetItemKeysArray(const String &group_name)
Get item keys array with the specific group name.
WStringArray trigger_values
Array of trigger values. The count of triggered values is no more then triggered_count.
Definition: fs_compliancecommon.h:751
bool GenerateReport(const PreflightReportSettingData &preflight_report_setting_data, ProgressCallback *progress_callback=0)
Generate report after analyzing or fixing.
CheckSeverity severity
The check severity of current hit data. Please refer to values starting from HitData::e_CheckSeverity...
Definition: fs_compliancecommon.h:745
WIDE STRING CLASS.
Definition: fx_string.h:1461
HitData & operator=(const HitData &other)
Assign operator.
Definition: fs_compliancecommon.h:697
Definition: fs_compliancecommon.h:654
int GetHitDataCount() const
Get count of hit data.
Viewing or printing condition:Japan Color 2001 Coated.
Definition: fs_compliancecommon.h:64
Definition: fs_compliancecommon.h:221
Problems highlighted by transparent masks.
Definition: fs_compliancecommon.h:356
PreflightSettingData(const wchar_t *preflight_key, OperateType operate_type, const wchar_t *src_pdf_path, const wchar_t *saved_pdf_path, int first_page_index, int last_page_index)
Constructor, with parameters.
Definition: fs_compliancecommon.h:276
ViewOrPrintCondition
Enumeration for viewing or printing condition.
Definition: fs_compliancecommon.h:56
HitData()
Constructor.
Definition: fs_compliancecommon.h:672
Definition: fs_compliancecommon.h:331
PreflightReportSettingData & operator=(const PreflightReportSettingData &data)
Assign operator.
Definition: fs_compliancecommon.h:401
HitData(const HitData &other)
Constructor, with another hit data object.
Definition: fs_compliancecommon.h:682
FixupState state
Fixup state. Please refer to values starting from FixupData::e_FixupStateSuccess and this should be o...
Definition: fs_compliancecommon.h:642
WStringArray reasons
Fixup reasons. This may be an empty array. The count of reasons will not exceed used_times.
Definition: fs_compliancecommon.h:648
virtual void UpdateCurrentStateData(int current_rate, const WString &current_state_string)=0
A callback function used to update current progress state data to user in order that user can update ...
int GetFixupDataCount() const
Get count of fixup data.
Preflight library type: Prepress,Color and Transparency.
Definition: fs_compliancecommon.h:234
bool operator==(const ResultInformation &other) const
Equal operator.
bool IsEmpty() const
Check whether current object is empty or not.
WString comment
Hit rule comment to explain more details about the rule.
Definition: fs_compliancecommon.h:749
FixupData(const FixupData &other)
Constructor, with another fixup data object.
Definition: fs_compliancecommon.h:581
bool operator==(const FixupData &other) const
Equal operator.
Definition: fs_compliancecommon.h:611
static void EnableHandleTransparency(bool enable_handle_transparency)
Set a flag to decide whether to enable transparency handling.
FixupState
Enumeration for the state of a fixup data.
Definition: fs_compliancecommon.h:561
Definition: fs_compliancecommon.h:197
WString name
Fixup rule name.
Definition: fs_compliancecommon.h:644
ErrorCode
Enumeration for error code.
Definition: fs_basictypes.h:237
int last_page_index
Index of the last page to be analyzed or fixed. If this is -1, that means all the pages of the source...
Definition: fs_compliancecommon.h:327
bool operator==(const Preflight &other) const
Equal operator.
bool operator==(const HitData &other) const
Equal operator.
Definition: fs_compliancecommon.h:714
Opearte type: single fixups.
Definition: fs_compliancecommon.h:248
Viewing or printing condition: PSO Coated v3 (ECI).
Definition: fs_compliancecommon.h:66
static void SetTempFolderPath(const wchar_t *temp_folder_path)
Set the temporary folder for compliance engine.
Viewing or printing condition:ISO Coated v2 (ECI).
Definition: fs_compliancecommon.h:62
Opearte type: single checks.
Definition: fs_compliancecommon.h:246
Definition: fs_compliancecommon.h:49
A fixup failed.
Definition: fs_compliancecommon.h:565
Viewing or printing condition: Auto.
Definition: fs_compliancecommon.h:58
bool operator !=(const ResultInformation &other) const
Not equal operator.
Report file format type: HTML.
Definition: fs_compliancecommon.h:346
FX_UINT32 uint32
32-bit unsigned integer.
Definition: fs_basictypes.h:196
void * FS_HANDLE
Handle type.
Definition: fs_basictypes.h:214
Header file for common definitions and classes.
WString comment
Fixup rule comment to explain more details about the rule.
Definition: fs_compliancecommon.h:646
bool operator !=(const FixupData &other) const
Not equal operator.
Definition: fs_compliancecommon.h:632
bool operator !=(const Preflight &other) const
Not equal operator.
Info severity.
Definition: fs_compliancecommon.h:663
Warning severity.
Definition: fs_compliancecommon.h:665
PreflightSettingData & operator=(const PreflightSettingData &data)
Assign operator.
Definition: fs_compliancecommon.h:293
uint32 used_count
Represents the count of fixup operation invocations for current data during the conversion.
Definition: fs_compliancecommon.h:637
Definition: fs_basictypes.h:449
void Analyze(const PreflightSettingData &preflight_setting_data, ProgressCallback *progress_callback=0)
Analyze a PDF file.
Definition: fs_basictypes.h:230
OperateType
Enumeration for the preflight operate type.
Definition: fs_compliancecommon.h:242
static void Release()
Release compliance engine.
CheckSeverity
Enumeration for check severity of a hit data.
Definition: fs_compliancecommon.h:661
WString name
Hit rule name.
Definition: fs_compliancecommon.h:747
WString src_pdf_path
A complete path of source PDF file to be analyze and fix.
Definition: fs_compliancecommon.h:314
Preflight & operator=(const Preflight &other)
Assign operator.
Foxit namespace.
Definition: fs_pdf3d.h:27
void AnalyzeAndFixup(const PreflightSettingData &preflight_setting_data, ProgressCallback *progress_callback=0)
Analyze and fixup a PDF file.
StringArray GetGroupNamesArray(const PreflightSettingData::LibraryType &library_type, const PreflightSettingData::OperateType &operate_type)
Get all group names array corresponding to the library type and operation type.
ProblemsHighlightMethod problems_highlight_method
The method highlight problems. Only effective when to_highlight_problems is true and report_file_form...
Definition: fs_compliancecommon.h:427
BYTE STRING CLASS.
Definition: fx_string.h:317
static void ReleaseThreadContext()
Release compliance context of the thread.
size_t GetSize() const
Get the size of elements in current array.
bool IsEmpty() const
Check whether current object is empty or not.
Report file format type: TXT & TEXT.
Definition: fs_compliancecommon.h:344
Preflight library type: Standards.
Definition: fs_compliancecommon.h:232
Report file format type: PDF.
Definition: fs_compliancecommon.h:340
static ErrorCode Initialize(const wchar_t *compliance_resource_folder_path, const char *compliance_engine_unlockcode)
Initialize compliance engine.
Opearte type: profiles.
Definition: fs_compliancecommon.h:244
static void SetLanguage(const char *language)
Set language for compliance engine.
ResultInformation & operator=(const ResultInformation &other)
Assign operator.
#define NULL
The null-pointer value.
Definition: fx_system.h:792
PreflightReportSettingData(ReportFileFormatType report_file_format_type, bool to_generate_overview, bool to_highlight_problems, ProblemsHighlightMethod problem_highlight_method, const wchar_t *report_file_path)
Constructor, with parameters.
Definition: fs_compliancecommon.h:385
OperateType operate_type
The preflight operate type. Please refer to values starting from PreflightSettingData::e_OperateTypeP...
Definition: fs_compliancecommon.h:311
ReportFileFormatType report_file_format_type
The report file format type. Please refer to values starting from PreflightReportSettingData::e_Repor...
Definition: fs_compliancecommon.h:414
A fixup was not required.
Definition: fs_compliancecommon.h:567
PreflightSettingData()
Constructor.
Definition: fs_compliancecommon.h:253
Problems highlighted by layers.
Definition: fs_compliancecommon.h:358
WString report_file_path
A complete path for the report file. This should not be an empty string.
Definition: fs_compliancecommon.h:430
Definition: fs_compliancecommon.h:554
ProblemsHighlightMethod
Enumeration for the highlight method for preflight problems.
Definition: fs_compliancecommon.h:354
static ErrorCode InitializeThreadContext()
Initialize compliance context for a new thread.
Definition: fs_compliancecommon.h:436
Viewing or printing condition:Coated GRACoL 2006.
Definition: fs_compliancecommon.h:60
WString saved_pdf_path
A complete path for saving the PDF file generated by the preflight analysis and fixup process.
Definition: fs_compliancecommon.h:317
bool to_highlight_problems
Whether to highlight problems or not. true menas to highlight problems, false means not.
Definition: fs_compliancecommon.h:420
WString preflight_key
The preflight key. Retrieve available keys via Preflight::GetItemKeysArray.
Definition: fs_compliancecommon.h:304