All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Optimizer.h
Go to the documentation of this file.
1 //---------------------------------------------------------------------------------------
2 // Copyright (c) 2001-2024 by Apryse Software Inc. All Rights Reserved.
3 // Consult legal.txt regarding legal and license information.
4 //---------------------------------------------------------------------------------------
5 #ifndef PDFTRON_H_CPPPDFOptimizer
6 #define PDFTRON_H_CPPPDFOptimizer
7 
8 #include <PDF/PDFDoc.h>
9 #include <C/PDF/TRN_Optimizer.h>
10 
11 namespace pdftron{
12  namespace PDF{
13 
14 
15 class ImageSettings;
16 class MonoImageSettings;
17 class TextSettings;
18 class OptimizerSettings;
19 
41 class Optimizer
42 {
43 public:
48 
49 
60  static void Optimize(PDFDoc& doc, const OptimizerSettings& settings);
61  static void Optimize(PDFDoc& doc);
62 
63  // @cond PRIVATE_DOC
64 
65 #ifndef SWIGHIDDEN
66 private:
67  Optimizer() {};
68 #endif
69  // @endcond
70 
71 };
72 
73 
78 class ImageSettings : public TRN_OptimizerImageSettings
79 {
80 public:
82  {
88  };
89 
91  {
94  };
98  ImageSettings();
99 
108  void SetImageDPI(double maximum,double resampling);
109 
115  void SetCompressionMode(enum CompressionMode mode);
116 
122  void SetDownsampleMode(enum DownsampleMode mode);
123 
129  void SetQuality(UInt32 quality);
130 
139  void ForceRecompression(bool force);
140 
146  void ForceChanges(bool force);
147 };
148 
153 class MonoImageSettings : public TRN_OptimizerMonoImageSettings
154 {
155 public:
157  {
162  };
163 
165  {
168  };
169 
174 
183  void SetImageDPI(double maximum,double resampling);
184 
190  void SetCompressionMode(enum CompressionMode mode);
191 
192 
198  void SetDownsampleMode(enum DownsampleMode mode);
199 
200 
209  void ForceRecompression(bool force);
210 
216  void ForceChanges(bool force);
217 
224  void SetJBIG2Threshold(double jbig2_threshold);
225 
226 };
227 
231 class TextSettings : public TRN_OptimizerTextSettings
232 {
233 public:
237  TextSettings();
238 
245  void SubsetFonts(bool subset);
246 
254  void EmbedFonts(bool embed);
255 };
256 
261 {
262 public:
267 
271  void SetColorImageSettings(const ImageSettings& settings);
272 
276  void SetGrayscaleImageSettings(const ImageSettings& settings);
277 
281  void SetMonoImageSettings(const MonoImageSettings& settings);
282 
286  void SetTextSettings(const TextSettings& settings);
287 
292  void RemoveCustomEntries(bool should_remove);
293 
299 };
300 
301 
302 #include <Impl/Optimizer.inl>
303 
304  } // namespace PDF
305 } // namespace pdftron
306 
307 #endif // PDFTRON_H_CPPPDFOptimizer
ImageSettings m_grayscale_image_settings
Definition: Optimizer.h:295
void SetMonoImageSettings(const MonoImageSettings &settings)
void SetDownsampleMode(enum DownsampleMode mode)
void SetDownsampleMode(enum DownsampleMode mode)
pdftron::PDF::ImageSettings ImageSettings
Definition: Optimizer.h:44
void SetImageDPI(double maximum, double resampling)
void SetTextSettings(const TextSettings &settings)
void SetGrayscaleImageSettings(const ImageSettings &settings)
pdftron::PDF::MonoImageSettings MonoImageSettings
Definition: Optimizer.h:45
void ForceChanges(bool force)
void ForceRecompression(bool force)
static void Optimize(PDFDoc &doc, const OptimizerSettings &settings)
ImageSettings m_color_image_settings
Definition: Optimizer.h:294
TRN_UInt32 UInt32
Definition: BasicTypes.h:13
void SetImageDPI(double maximum, double resampling)
void SetJBIG2Threshold(double jbig2_threshold)
void SubsetFonts(bool subset)
void SetQuality(UInt32 quality)
pdftron::PDF::OptimizerSettings OptimizerSettings
Definition: Optimizer.h:47
void EmbedFonts(bool embed)
pdftron::PDF::TextSettings TextSettings
Definition: Optimizer.h:46
MonoImageSettings m_mono_image_settings
Definition: Optimizer.h:296
void SetColorImageSettings(const ImageSettings &settings)
void SetCompressionMode(enum CompressionMode mode)
void RemoveCustomEntries(bool should_remove)
void SetCompressionMode(enum CompressionMode mode)
void ForceRecompression(bool force)