- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PDFRasterizer.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_CPPPDFRasterizer
6 #define PDFTRON_H_CPPPDFRasterizer
7
8 #include <PDF/Page.h>
9 #include <C/PDF/TRN_PDFRasterizer.h>
10 #include <PDF/OCG/Context.h>
11 #ifdef SWIG
12 #include <PDF/Callback.h>
13 #endif
14 #include <C/Common/TRN_Types.h>
15
16 namespace pdftron {
17 namespace PDF {
18
20 enum DownloadedType
21 {
23 e_downloadedtype_page = 0,
25 e_downloadedtype_thumb,
27 e_downloadedtype_named_dests,
29 e_downloadedtype_outline,
31 e_downloadedtype_finished,
33 e_downloadedtype_failed,
35 e_downloadedtype_opened
36 };
37
38 class PDFDoc;
44 typedef void (*DownloadReportHandler) (DownloadedType type, PDFDoc* doc, int page_num, int obj_num, const char* message, void* data);
45
49 class Separation : public TRN_separation
50 {
51 public:
52 Separation();
53 ~Separation();
54 Separation(const Separation&);
55 Separation& operator= (const Separation&);
56 UInt8 C() const;
57 UInt8 M() const;
58 UInt8 Y() const;
59 UInt8 K() const;
60 UInt32 GetDataSize() const;
61 UString GetSeparationName() const;
62 #ifdef SWIG
63 std::vector<unsigned char> GetData() const;
64 #else
65 const UChar* GetData() const;
66 #endif
67
68 UString m_separation_name;
69
70 private:
71 bool m_owner;
72 };
73
85 class PDFRasterizer
86 {
87 public:
88
103 enum Type {
104 e_BuiltIn,
105 e_GDIPlus
106 };
107
114 enum OverprintPreviewMode {
115 e_op_off = 0,
116 e_op_on,
117 e_op_pdfx_on
118 };
119
123 PDFRasterizer(Type type = e_BuiltIn);
124 ~PDFRasterizer();
125
179 #ifndef SWIG
180 std::vector<unsigned char> Rasterize(Page& page,
181 int width, int height, int stride,
182 int num_comps, bool demult,
183 const Common::Matrix2D& device_mtx,
184 const Rect* clip = 0,
185 const Rect* scrl_clip_regions = 0,
186 bool* cancel = 0);
187
188 void Rasterize(Page& page, UChar* in_out_image_buffer,
189 int width, int height, int stride,
190 int num_comps, bool demult,
191 const Common::Matrix2D& device_mtx,
192 const Rect* clip = 0,
193 const Rect* scrl_clip_regions = 0,
194 bool* cancel = 0);
195 #else // SWIG
196 std::vector<unsigned char> Rasterize(
197 Page& page,
198 int width,
199 int height,
200 int stride,
201 int num_comps,
202 bool demult,
203 const Common::Matrix2D& device_mtx,
204 const Rect* clip = 0,
205 const Rect* scrl_clip_regions = 0
206 );
207 #endif // SWIG
208
225 std::vector<Separation> RasterizeSeparations(
226 Page& page,
227 int width,
228 int height,
229 const Common::Matrix2D& mtx,
230 const Rect* clip,
231 volatile bool* cancel
232 );
233
234 #ifdef _WIN32
235
264 void Rasterize(Page& page, void* hdc,
265 const Common::Matrix2D& device_mtx,
266 const Rect* clip = 0,
267 int dpi = -1,
268 bool* cancel = 0);
269 #endif
270
276 void SetDrawAnnotations(bool render_annots);
277
283 void SetHighlightFields(bool highlight_fields);
284
290 void SetDrawUIElements(bool draw_ui_elements);
291
301 void SetAntiAliasing(bool enable_aa);
302
311 void SetPathHinting(bool enable_hinting);
312
323 void SetThinLineAdjustment(bool pixel_grid_fit, bool stroke_adjust);
324
334 void SetThinLineScaling(double scaling);
335
345 void SetNightModeTuning(double contrast, double saturation, double flipness);
346
361 void SetImageSmoothing(bool smoothing_enabled = true, bool hq_image_resampling = false);
362
369 void SetCaching(bool enabled = true);
370
383 void SetGamma(double expgamma);
384
394 void SetOCGContext(OCG::Context* ctx);
395
405 void SetPrintMode(bool is_printing);
406
416 void SetOverprint(OverprintPreviewMode op);
417
423 typedef void (*ErrorReportProc) (const char* message, void* data);
424
432 #ifdef SWIG
433 void SetErrorReportProc(Callback* instance);
434 #else
435 void SetErrorReportProc(ErrorReportProc error_proc, void* data);
436 #endif
437
449 void SetRasterizerType (Type type);
450
456 Type GetRasterizerType ();
457
461 enum ColorPostProcessMode
462 {
463 e_postprocess_none = 0,
464 e_postprocess_invert,
465 e_postprocess_gradient_map,
466 e_postprocess_night_mode
467 };
468
478 void SetColorPostProcessMode(ColorPostProcessMode mode);
479
483 ColorPostProcessMode GetColorPostProcessMode() const;
484
490 void UpdateBuffer();
491
495 void Destroy();
496
497 // @cond PRIVATE_DOC
498 #ifndef SWIGHIDDEN
499 TRN_PDFRasterizer mp_rast;
500 private:
501 PDFRasterizer(const PDFRasterizer&);
502 PDFRasterizer& operator= (const PDFRasterizer&);
503 #endif
504 // @endcond
505 };
506
507
508
509 #include <Impl/PDFRasterizer.inl>
510
511
512 }; // namespace PDF
513 }; // namespace pdftron
514
515 #endif // PDFTRON_H_CPPPDFRasterizer
pdftron::PDF::PDFRasterizer::SetCaching
void SetCaching(bool enabled=true)
pdftron::PDF::Separation::GetSeparationName
UString GetSeparationName() const
pdftron::PDF::PDFRasterizer::SetImageSmoothing
void SetImageSmoothing(bool smoothing_enabled=true, bool hq_image_resampling=false)
pdftron::PDF::PDFRasterizer::e_postprocess_invert
Definition: PDFRasterizer.h:464
pdftron::PDF::PDFRasterizer::e_postprocess_gradient_map
Definition: PDFRasterizer.h:465
pdftron::PDF::Separation::GetDataSize
UInt32 GetDataSize() const
pdftron::PDF::OCG::Context
Definition: Context.h:41
pdftron::PDF::PDFRasterizer::e_op_pdfx_on
Definition: PDFRasterizer.h:117
pdftron::PDF::PDFRasterizer
Definition: PDFRasterizer.h:85
pdftron::PDF::DownloadedType
DownloadedType
Definition: PDFRasterizer.h:20
pdftron::UInt8
TRN_UInt8 UInt8
Definition: BasicTypes.h:15
pdftron::PDF::PDFRasterizer::ColorPostProcessMode
ColorPostProcessMode
Definition: PDFRasterizer.h:461
pdftron::PDF::Separation::M
UInt8 M() const
pdftron::PDF::e_downloadedtype_thumb
Definition: PDFRasterizer.h:25
pdftron::PDF::PDFRasterizer::SetThinLineAdjustment
void SetThinLineAdjustment(bool pixel_grid_fit, bool stroke_adjust)
pdftron::PDF::PDFRasterizer::SetErrorReportProc
void SetErrorReportProc(ErrorReportProc error_proc, void *data)
pdftron::PDF::PDFRasterizer::SetOverprint
void SetOverprint(OverprintPreviewMode op)
pdftron::PDF::PDFRasterizer::e_postprocess_night_mode
Definition: PDFRasterizer.h:466
pdftron::PDF::e_downloadedtype_failed
Definition: PDFRasterizer.h:33
pdftron::PDF::PDFRasterizer::SetGamma
void SetGamma(double expgamma)
pdftron::PDF::PDFRasterizer::UpdateBuffer
void UpdateBuffer()
pdftron::PDF::Separation::K
UInt8 K() const
pdftron::PDF::PDFRasterizer::Rasterize
std::vector< unsigned char > Rasterize(Page &page, int width, int height, int stride, int num_comps, bool demult, const Common::Matrix2D &device_mtx, const Rect *clip=0, const Rect *scrl_clip_regions=0, bool *cancel=0)
pdftron::PDF::PDFRasterizer::SetRasterizerType
void SetRasterizerType(Type type)
pdftron::PDF::Separation::Separation
Separation()
pdftron::PDF::Separation::GetData
const UChar * GetData() const
pdftron::PDF::PDFRasterizer::GetColorPostProcessMode
ColorPostProcessMode GetColorPostProcessMode() const
pdftron::PDF::PDFRasterizer::SetPathHinting
void SetPathHinting(bool enable_hinting)
pdftron::PDF::Rect
Definition: Rect.h:28
pdftron::PDF::Separation
Definition: PDFRasterizer.h:49
pdftron::PDF::PDFRasterizer::e_op_on
Definition: PDFRasterizer.h:116
Callback.h
pdftron::PDF::e_downloadedtype_named_dests
Definition: PDFRasterizer.h:27
pdftron::PDF::PDFRasterizer::ErrorReportProc
void(* ErrorReportProc)(const char *message, void *data)
Definition: PDFRasterizer.h:423
pdftron::PDF::PDFDoc
Definition: PDFDoc.h:71
pdftron::PDF::Separation::operator=
Separation & operator=(const Separation &)
pdftron::UInt32
TRN_UInt32 UInt32
Definition: BasicTypes.h:13
pdftron::Common::Matrix2D
Definition: Matrix2D.h:103
pdftron::PDF::PDFRasterizer::SetAntiAliasing
void SetAntiAliasing(bool enable_aa)
pdftron::PDF::PDFRasterizer::OverprintPreviewMode
OverprintPreviewMode
Definition: PDFRasterizer.h:114
pdftron::PDF::Separation::m_separation_name
UString m_separation_name
Definition: PDFRasterizer.h:68
pdftron::UChar
TRN_UChar UChar
Definition: BasicTypes.h:12
pdftron::PDF::Separation::~Separation
~Separation()
pdftron::PDF::PDFRasterizer::e_GDIPlus
GDI+ based rasterizer. (Deprecated)
Definition: PDFRasterizer.h:105
pdftron::PDF::PDFRasterizer::RasterizeSeparations
std::vector< Separation > RasterizeSeparations(Page &page, int width, int height, const Common::Matrix2D &mtx, const Rect *clip, volatile bool *cancel)
pdftron::PDF::Separation::Y
UInt8 Y() const
pdftron::PDF::PDFRasterizer::~PDFRasterizer
~PDFRasterizer()
pdftron::PDF::PDFRasterizer::SetColorPostProcessMode
void SetColorPostProcessMode(ColorPostProcessMode mode)
pdftron::PDF::DownloadReportHandler
void(* DownloadReportHandler)(DownloadedType type, PDFDoc *doc, int page_num, int obj_num, const char *message, void *data)
Definition: PDFRasterizer.h:44
pdftron::PDF::PDFRasterizer::SetNightModeTuning
void SetNightModeTuning(double contrast, double saturation, double flipness)
pdftron::PDF::PDFRasterizer::SetHighlightFields
void SetHighlightFields(bool highlight_fields)
pdftron::PDF::Page
Definition: Page.h:31
pdftron::PDF::PDFRasterizer::SetDrawUIElements
void SetDrawUIElements(bool draw_ui_elements)
pdftron::PDF::e_downloadedtype_finished
Definition: PDFRasterizer.h:31
Page.h
pdftron::PDF::PDFRasterizer::e_BuiltIn
high-quality, platform independent rasterizer.
Definition: PDFRasterizer.h:104
pdftron::PDF::PDFRasterizer::e_postprocess_none
Definition: PDFRasterizer.h:463
pdftron::PDF::e_downloadedtype_outline
Definition: PDFRasterizer.h:29
pdftron::PDF::e_downloadedtype_page
Definition: PDFRasterizer.h:23
pdftron::PDF::e_downloadedtype_opened
Definition: PDFRasterizer.h:35
pdftron::PDF::PDFRasterizer::Destroy
void Destroy()
pdftron::PDF::PDFRasterizer::Type
Type
Definition: PDFRasterizer.h:103
pdftron::PDF::PDFRasterizer::SetThinLineScaling
void SetThinLineScaling(double scaling)
pdftron::PDF::PDFRasterizer::GetRasterizerType
Type GetRasterizerType()
pdftron::PDF::Separation::C
UInt8 C() const
pdftron::PDF::PDFRasterizer::SetDrawAnnotations
void SetDrawAnnotations(bool render_annots)
pdftron::UString
Definition: UString.h:27
pdftron::PDF::PDFRasterizer::SetOCGContext
void SetOCGContext(OCG::Context *ctx)
pdftron::PDF::PDFRasterizer::PDFRasterizer
PDFRasterizer(Type type=e_BuiltIn)
Context.h
pdftron::PDF::PDFRasterizer::e_op_off
Definition: PDFRasterizer.h:115
pdftron::PDF::PDFRasterizer::SetPrintMode
void SetPrintMode(bool is_printing)