Foxit PDF SDK
fs_render.h
Go to the documentation of this file.
1 
15 #ifndef FS_RENDER_H_
16 #define FS_RENDER_H_
17 
18 #include "common/fs_common.h"
19 #include "common/fs_image.h"
20 #ifndef __EMSCRIPTEN_RENDER__
21 #include "pdf/annots/fs_annot.h"
22 #include "pdf/fs_pdflayer.h"
23 #include "pdf/fs_reflowpage.h"
24 #ifndef _FX_NO_XFA_
25 #include "addon/xfa/fs_xfa.h"
26 #endif // #ifndef _FX_NO_XFA_
27 #endif
28 
29 #ifdef __APPLE__
30 #include <CoreGraphics/CoreGraphics.h>
31 #endif
32 
37 namespace foxit {
38 namespace pdf {
39 class PDFPage;
40 }
44 namespace common {
50 class PrintDeviceSettingData FS_FINAL : public Object{
51  public:
57  typedef enum _OrientationFlag {
63 
82  , copies(copies){}
83 
91  : device_width(2479)
92  , device_height(3508)
94  , resolution(300)
95  , copies(1) {}
96 
103  : device_width(settings.device_width)
104  , device_height(settings.device_height)
105  , device_margin(settings.device_margin)
106  , orientation(settings.orientation)
107  , resolution(settings.resolution)
108  , copies(settings.copies) {}
109 
118  device_width = settings.device_width;
119  device_height = settings.device_height;
120  device_margin = settings.device_margin;
121  orientation = settings.orientation;
122  resolution = settings.resolution;
123  copies = settings.copies;
124  return *this;
125  }
126 
142  this->device_width = device_width;
143  this->device_height = device_height;
144  this->device_margin = device_margin;
145  this->orientation = orientation;
146  this->resolution = resolution;
147  this->copies = copies;
148  }
169 };
170 
197 class Renderer FS_FINAL : public Base {
198  public:
204  typedef enum _ColorMode {
211  } ColorMode;
212 
218  typedef enum _ContentFlag {
220  e_RenderPage = 0x01,
223  } ContentFlag;
224 
225  #ifdef __APPLE__
226 
231  typedef enum _DeviceType {
233  e_DeviceDisplay = 1,
235  e_DevicePrinter = 2
236  }DeviceType;
237  #endif
238 
251  Renderer(const Bitmap& bitmap, bool is_rgb_order);
252 
265  Renderer(const PrintDeviceSettingData& print_param, const wchar_t* dest_file_path);
266 
267 #if (defined(_WIN32) || defined(_WIN64)) && (!defined(SWIG) || defined(_SWIG_DOTNET_) || defined(_SWIG_PYTHON_))
268 
275  explicit Renderer(HDC dc);
276 
286  Renderer(HDC dc, const wchar_t* printer_driver_name);
287 #endif
288 
289 #ifdef __APPLE__
290 
300  Renderer(const CGContextRef& context, DeviceType device_type);
301 #endif
302 
308  Renderer(const Renderer& other);
310  ~Renderer();
311 
319  Renderer& operator = (const Renderer& other);
327  bool operator == (const Renderer& other) const;
335  bool operator != (const Renderer& other) const;
336 
344  bool IsEmpty() const;
345 
369  Progressive StartQuickRender(const pdf::PDFPage& page, const Matrix& matrix, PauseCallback* pause = NULL);
370 
401  Progressive StartRender(const pdf::PDFPage& page, const Matrix& matrix, PauseCallback* pause = NULL);
402 #ifndef __EMSCRIPTEN_RENDER__
403 
421  Progressive StartRenderReflowPage(const pdf::ReflowPage& reflow_page, const Matrix& matrix,
422  PauseCallback* pause = NULL);
423 
424 #ifndef _FX_NO_XFA_
425 
445  Progressive StartRenderXFAPage(const addon::xfa::XFAPage& xfa_page_view, const Matrix& matrix, bool is_highlight,
446  PauseCallback* pause = NULL);
447 #endif // #ifndef _FX_NO_XFA_
448 #endif
449 
474  Progressive StartRenderBitmap(const Bitmap& bitmap, const Matrix& matrix,
475  const RectI* clip_rect = NULL, uint32 interpolation = 0,
476  PauseCallback* pause = NULL);
477 #ifndef __EMSCRIPTEN_RENDER__
478 
487 
501  bool RenderAnnot(const pdf::annots::Annot& annot, const Matrix& matrix);
502 #endif
503 
515  bool RenderFormControls(const pdf::PDFPage& page, const Matrix& matrix);
516 #ifndef __EMSCRIPTEN_RENDER__
517 
530  bool RenderGraphicsObject(const pdf::graphics::GraphicsObject* graphics_object, const pdf::PDFPage& page, const Matrix& matrix);
531 #endif
532 
540  void SetClipRect(const RectI* clip_rect);
541 
552  void SetClipPathFill(const Path& clip_path, const Matrix& matrix, foxit::common::FillMode fill_mode);
553 
564  void SetClipPathStroke(const Path& clip_path, const Matrix& matrix, const GraphState* graph_state = NULL);
565 
578  void SetRenderContentFlags(uint32 render_content_flags);
579 
594  void SetRenderAnnotsForThumbnail(bool is_render_annots_for_thumbnail);
595 
606  void SetRenderFormField(bool is_render_formfield);
607 
618  void SetRenderSignature(bool is_render_signature);
619 #ifndef __EMSCRIPTEN_RENDER__
620 
630  void SetLayerContext(const pdf::LayerContext& layer_context);
631 #endif
632 
655  void SetColorMode(ColorMode color_mode);
665  void SetMappingModeColors(ARGB background_color, ARGB foreground_color);
666 
677  void SetClearType(bool is_clear_type);
690  void SetPrintTextAsGraphic(bool is_to_print_text_graphic);
691 
702  void SetPrintTextAsImage(bool is_to_print_text_image);
703 
714  void SetForceDownSample(bool is_to_force_down_sample);
715 
729  void SetJPEGDownSample(bool is_jepg_down_sample);
730 
744  void SetJPXDownSample(bool is_jpx_down_sample);
745 
758  void EnableForPrint(bool is_render_for_print);
759 
770  void SetForceHalftone(bool is_to_force_halftone);
771 
782  void SetRenderPathThinLine(bool is_render_path_thin_line);
783 
794  void SetRenderTextAntiAliasing(bool is_render_text_antialiasing);
795 
806  void SetRenderPathAntiAliasing(bool is_render_path_antialiasing);
807 
817  void SetRenderPathFullCovered(bool is_render_path_full_covered);
818 
830  void SetRenderImageAntiAliasing(bool is_render_image_antialiasing);
831 
843  void SetRenderEnhanceThinLines(bool is_render_enhance_thin_lines);
844 
853  void SetRenderSignatureState(bool is_render_signature_state);
854 
855  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
856  explicit Renderer(FS_HANDLE handle = NULL);
857 };
858 } // namespace common
859 } // namespace foxit
860 #endif // FS_RENDER_H_
861 
Definition: fs_pdfgraphicsobject.h:241
void SetRenderContentFlags(uint32 render_content_flags)
Set rendering flag to decide what content will be rendered.
PrintDeviceSettingData()
Constructor and set the default value.
Definition: fs_render.h:90
Header file for PDF reflow page related definitions and classes.
Progressive StartRenderBitmap(const Bitmap &bitmap, const Matrix &matrix, const RectI *clip_rect=0, uint32 interpolation=0, PauseCallback *pause=0)
Start to render a bitmap.
Definition: fs_reflowpage.h:62
void SetRenderAnnotAppearanceType(foxit::pdf::annots::Annot::AppearanceType ap_type)
Set the annotation's appearance type for rendering.
PrintDeviceSettingData(int device_width, int device_height, RectF device_margin, OrientationFlag orientation, int resolution, uint32 copies)
Constructor, with parameters.
Definition: fs_render.h:76
Renderer & operator=(const Renderer &other)
Assign operator.
void Set(int device_width, int device_height, RectF device_margin, OrientationFlag orientation, int resolution, uint32 copies)
Set value.
Definition: fs_render.h:141
CFX_Object Object
Object type.
Definition: fs_basictypes.h:221
IFX_Pause PauseCallback
Definition: fs_common.h:1197
void SetJPXDownSample(bool is_jpx_down_sample)
Set the flag to decide whether to use down-sampling for jpx image.
void SetRenderImageAntiAliasing(bool is_render_image_antialiasing)
Set the flag to decide whether to draw image anti-aliasing.
Progressive StartQuickRender(const pdf::PDFPage &page, const Matrix &matrix, PauseCallback *pause=0)
Start to quickly render a PDF page, mainly for thumbnail purpose.
Definition: fs_xfa.h:1237
void EnableForPrint(bool is_render_for_print)
Set the flag to decide whether to do rendering in print mode.
void SetClipRect(const RectI *clip_rect)
Set the clipping rectangle which will be used in following rendering progress.
If set, page content will be rendered.
Definition: fs_render.h:220
void SetRenderPathAntiAliasing(bool is_render_path_antialiasing)
Set the flag to decide whether to draw path anti-aliasing.
ColorMode
Enumeration for rendering color mode.
Definition: fs_render.h:204
bool IsEmpty() const
Check whether current object is empty or not.
Progressive StartRenderXFAPage(const addon::xfa::XFAPage &xfa_page_view, const Matrix &matrix, bool is_highlight, PauseCallback *pause=0)
Start to render an XFA page.
uint32 copies
The number of copies to be printed. This parameter only has an effect on PostScrip files.
Definition: fs_render.h:168
void SetRenderTextAntiAliasing(bool is_render_text_antialiasing)
Set the flag to decide whether to draw text anti-aliasing.
void SetForceHalftone(bool is_to_force_halftone)
Set the flag to decide whether to use halftone for image stretching.
PrintDeviceSettingData(const PrintDeviceSettingData &settings)
Constructor, with another print device setting data object.
Definition: fs_render.h:102
void SetJPEGDownSample(bool is_jepg_down_sample)
Set the flag to decide whether to use down-sampling for jpeg image.
Header file for PDF layer related definitions and classes.
Header file for image and bitmap related definitions and classes.
Map gray/white/black color value to background/foreground; for other colors, no change.
Definition: fs_render.h:208
void SetColorMode(ColorMode color_mode)
Set color mode.
Definition: fs_render.h:197
void SetRenderPathFullCovered(bool is_render_path_full_covered)
A special flag that can be applied to fill mode.
void SetClipPathFill(const Path &clip_path, const Matrix &matrix, foxit::common::FillMode fill_mode)
Set clipping path using filled region.
uint32 ARGB
ARGB color type, 32 bits, ((b) | ((g) << 8) | ((r) << 16)) | ((a) << 24)
Definition: fs_basictypes.h:210
Progressive StartRenderReflowPage(const pdf::ReflowPage &reflow_page, const Matrix &matrix, PauseCallback *pause=0)
Start to render a reflow page.
void SetRenderAnnotsForThumbnail(bool is_render_annots_for_thumbnail)
Set rendering flag to decide whether to render annotations in thumbnail mode or not.
int device_width
The width of the device in pixels.
Definition: fs_render.h:150
void SetClearType(bool is_clear_type)
Set the flag to decide whether to use ClearType-like anti-aliasing to render text objects.
Header file for annotation related definitions and classes.
FillMode
Enumeration for filling mode type, mainly for path graphics object.
Definition: fs_common.h:108
OrientationFlag
Enumeration for specifying the orientation of the printer.
Definition: fs_render.h:57
Renderer(const Bitmap &bitmap, bool is_rgb_order)
Constructor, with bitmap.
void SetRenderPathThinLine(bool is_render_path_thin_line)
Set the flag to decide whether to draw path as thin line.
int resolution
The resolution of the device in pixels per inch.
Definition: fs_render.h:166
void SetRenderFormField(bool is_render_formfield)
Set the flag to decide whether to render form fields (except signature fields).
Map a color value to the color range defined by a background color and a foreground color.
Definition: fs_render.h:210
If set, annotations will be rendered.
Definition: fs_render.h:222
FX_UINT32 uint32
32-bit unsigned integer.
Definition: fs_basictypes.h:196
Definition: fs_pdfpage.h:412
void * FS_HANDLE
Handle type.
Definition: fs_basictypes.h:214
PrintDeviceSettingData & operator=(const PrintDeviceSettingData &settings)
Assign operator.
Definition: fs_render.h:117
Header file for common definitions and classes.
Progressive StartRender(const pdf::PDFPage &page, const Matrix &matrix, PauseCallback *pause=0)
Start to render a PDF page.
Normal color mode.
Definition: fs_render.h:206
bool operator !=(const Renderer &other) const
Not equal operator.
Landscape orientation for printing.
Definition: fs_render.h:61
Definition: fx_coordinates.h:596
OrientationFlag orientation
Orientation flag. Please refer to values starting from OrientationFlag::e_Portrait and this should be...
Definition: fs_render.h:164
Definition: fs_render.h:50
Definition: fs_basictypes.h:443
Definition: fs_pdflayer.h:323
bool RenderGraphicsObject(const pdf::graphics::GraphicsObject *graphics_object, const pdf::PDFPage &page, const Matrix &matrix)
Render a graphics object.
void SetLayerContext(const pdf::LayerContext &layer_context)
Set layer context to render context handle.
void SetForceDownSample(bool is_to_force_down_sample)
Set the flag to decide whether to use down-sampling for image stretching.
Header file for XFA related definitions and functions.
bool RenderAnnot(const pdf::annots::Annot &annot, const Matrix &matrix)
Render a specified annotation.
Definition: fs_annot.h:994
void SetRenderSignature(bool is_render_signature)
Set the flag to decide whether to render signatures or not.
Foxit namespace.
Definition: fs_pdf3d.h:27
int device_height
The height of the device in pixels.
Definition: fs_render.h:152
AppearanceType
Enumeration for the type of annotation's appearance.
Definition: fs_annot.h:1278
void SetPrintTextAsImage(bool is_to_print_text_image)
Set the flag to decide whether to print text as image.
ContentFlag
Enumeration for rendering content flags.
Definition: fs_render.h:218
void SetMappingModeColors(ARGB background_color, ARGB foreground_color)
Set background color and foreground color when color mode is Renderer::e_ColorModeMappingGray or Rend...
Portrait orientation for printing.
Definition: fs_render.h:59
#define NULL
The null-pointer value.
Definition: fx_system.h:792
bool operator==(const Renderer &other) const
Equal operator.
void SetRenderSignatureState(bool is_render_signature_state)
Set the flag to decide whether to draw the signature state on the signature.
RectF device_margin
The page margins of the device.
Definition: fs_render.h:159
Definition: fx_coordinates.h:1076
void SetPrintTextAsGraphic(bool is_to_print_text_graphic)
Set the flag to decide whether to print text as path or bitmap.
bool RenderFormControls(const pdf::PDFPage &page, const Matrix &matrix)
Render form controls.
void SetRenderEnhanceThinLines(bool is_render_enhance_thin_lines)
Set the flag to decide whether to enhance thin lines.
void SetClipPathStroke(const Path &clip_path, const Matrix &matrix, const GraphState *graph_state=0)
Set clipping path using stroked region.
Definition: fx_coordinates.h:771