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 {
45 #if defined(__linux__) && !defined(__ANDROID__)
46 
52 class PostScriptDeviceSettingData FS_FINAL : public Object{
53  public:
59  typedef enum _OrientationFlag {
61  e_Portrait = 0,
63  e_Landscape = 1
64  } OrientationFlag;
65 
78  explicit PostScriptDeviceSettingData(int device_width, int device_height, RectF device_margin, OrientationFlag orientation , int resolution, uint32 copies)
79  : device_width(device_width)
80  , device_height(device_height)
81  , device_margin(device_margin)
82  , orientation(orientation)
83  , resolution(resolution)
84  , copies(copies){}
85 
92  PostScriptDeviceSettingData()
93  : device_width(2479)
94  , device_height(3508)
95  , orientation(e_Portrait)
96  , resolution(300)
97  , copies(1) {}
98 
104  PostScriptDeviceSettingData(const PostScriptDeviceSettingData& settings)
105  : device_width(settings.device_width)
106  , device_height(settings.device_height)
107  , device_margin(settings.device_margin)
108  , orientation(settings.orientation)
109  , resolution(settings.resolution)
110  , copies(settings.copies) {}
111 
119  PostScriptDeviceSettingData& operator = (const PostScriptDeviceSettingData& settings) {
120  device_width = settings.device_width;
121  device_height = settings.device_height;
122  device_margin = settings.device_margin;
123  orientation = settings.orientation;
124  resolution = settings.resolution;
125  copies = settings.copies;
126  return *this;
127  }
128 
143  void Set(int device_width, int device_height, RectF device_margin, OrientationFlag orientation, int resolution, uint32 copies ) {
144  this->device_width = device_width;
145  this->device_height = device_height;
146  this->device_margin = device_margin;
147  this->orientation = orientation;
148  this->resolution = resolution;
149  this->copies = copies;
150  }
152  int device_width;
154  int device_height;
161  RectF device_margin;
166  OrientationFlag orientation;
168  int resolution;
170  uint32 copies;
171 };
172 #endif
173 
200 class Renderer FS_FINAL : public Base {
201  public:
207  typedef enum _ColorMode {
214  } ColorMode;
215 
221  typedef enum _ContentFlag {
223  e_RenderPage = 0x01,
226  } ContentFlag;
227 
228  #ifdef __APPLE__
229 
234  typedef enum _DeviceType {
239  }DeviceType;
240  #endif
241 
255  Renderer(const Bitmap& bitmap, bool is_rgb_order);
256 
257 #if (defined(_WIN32) || defined(_WIN64)) && (!defined(SWIG) || defined(_SWIG_DOTNET_) || defined(_SWIG_PYTHON_))
258 
265  explicit Renderer(HDC dc);
266 
276  Renderer(HDC dc, const wchar_t* printer_driver_name);
277 #endif
278 
279 #ifdef __APPLE__
280 
290  Renderer(const CGContextRef& context, DeviceType device_type);
291 #endif
292 
293 #if defined(__linux__) && !defined(__ANDROID__)
294 
302  Renderer(const PostScriptDeviceSettingData& print_param, const wchar_t* dest_psfile_path);
303 #endif
304 
310  Renderer(const Renderer& other);
312  ~Renderer();
313 
321  Renderer& operator = (const Renderer& other);
329  bool operator == (const Renderer& other) const;
337  bool operator != (const Renderer& other) const;
338 
346  bool IsEmpty() const;
347 
371  Progressive StartQuickRender(const pdf::PDFPage& page, const Matrix& matrix, PauseCallback* pause = NULL);
372 
403  Progressive StartRender(const pdf::PDFPage& page, const Matrix& matrix, PauseCallback* pause = NULL);
404 #ifndef __EMSCRIPTEN_RENDER__
405 
423  Progressive StartRenderReflowPage(const pdf::ReflowPage& reflow_page, const Matrix& matrix,
424  PauseCallback* pause = NULL);
425 
426 #ifndef _FX_NO_XFA_
427 
447  Progressive StartRenderXFAPage(const addon::xfa::XFAPage& xfa_page_view, const Matrix& matrix, bool is_highlight,
448  PauseCallback* pause = NULL);
449 #endif // #ifndef _FX_NO_XFA_
450 #endif
451 
476  Progressive StartRenderBitmap(const Bitmap& bitmap, const Matrix& matrix,
477  const RectI* clip_rect = NULL, uint32 interpolation = 0,
478  PauseCallback* pause = NULL);
479 #ifndef __EMSCRIPTEN_RENDER__
480 
489 
503  bool RenderAnnot(const pdf::annots::Annot& annot, const Matrix& matrix);
504 #endif
505 
517  bool RenderFormControls(const pdf::PDFPage& page, const Matrix& matrix);
518 #ifndef __EMSCRIPTEN_RENDER__
519 
532  bool RenderGraphicsObject(const pdf::graphics::GraphicsObject* graphics_object, const pdf::PDFPage& page, const Matrix& matrix);
533 #endif
534 
542  void SetClipRect(const RectI* clip_rect);
543 
554  void SetClipPathFill(const Path& clip_path, const Matrix& matrix, foxit::common::FillMode fill_mode);
555 
566  void SetClipPathStroke(const Path& clip_path, const Matrix& matrix, const GraphState* graph_state = NULL);
567 
580  void SetRenderContentFlags(uint32 render_content_flags);
581 
596  void SetRenderAnnotsForThumbnail(bool is_render_annots_for_thumbnail);
597 
608  void SetRenderFormField(bool is_render_formfield);
609 
620  void SetRenderSignature(bool is_render_signature);
621 #ifndef __EMSCRIPTEN_RENDER__
622 
632  void SetLayerContext(const pdf::LayerContext& layer_context);
633 #endif
634 
657  void SetColorMode(ColorMode color_mode);
667  void SetMappingModeColors(ARGB background_color, ARGB foreground_color);
668 
679  void SetClearType(bool is_clear_type);
692  void SetPrintTextAsGraphic(bool is_to_print_text_graphic);
693 
704  void SetPrintTextAsImage(bool is_to_print_text_image);
705 
716  void SetForceDownSample(bool is_to_force_down_sample);
717 
731  void SetJPEGDownSample(bool is_jepg_down_sample);
732 
746  void SetJPXDownSample(bool is_jpx_down_sample);
747 
760  void EnableForPrint(bool is_render_for_print);
761 
772  void SetForceHalftone(bool is_to_force_halftone);
773 
784  void SetRenderPathThinLine(bool is_render_path_thin_line);
785 
796  void SetRenderTextAntiAliasing(bool is_render_text_antialiasing);
797 
808  void SetRenderPathAntiAliasing(bool is_render_path_antialiasing);
809 
819  void SetRenderPathFullCovered(bool is_render_path_full_covered);
820 
832  void SetRenderImageAntiAliasing(bool is_render_image_antialiasing);
833 
845  void SetRenderEnhanceThinLines(bool is_render_enhance_thin_lines);
846 
855  void SetRenderSignatureState(bool is_render_signature_state);
856 
857  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
858  explicit Renderer(FS_HANDLE handle = NULL);
859 };
860 } // namespace common
861 } // namespace foxit
862 #endif // FS_RENDER_H_
863 
foxit::common::Renderer::EnableForPrint
void EnableForPrint(bool is_render_for_print)
Set the flag to decide whether to do rendering in print mode.
foxit::common::Renderer::SetMappingModeColors
void SetMappingModeColors(ARGB background_color, ARGB foreground_color)
Set background color and foreground color when color mode is Renderer::e_ColorModeMappingGray or Rend...
foxit::common::Renderer::StartRenderReflowPage
Progressive StartRenderReflowPage(const pdf::ReflowPage &reflow_page, const Matrix &matrix, PauseCallback *pause=0)
Start to render a reflow page.
foxit::common::Renderer::SetRenderFormField
void SetRenderFormField(bool is_render_formfield)
Set the flag to decide whether to render form fields (except signature fields).
foxit::common::Renderer::SetClearType
void SetClearType(bool is_clear_type)
Set the flag to decide whether to use ClearType-like anti-aliasing to render text objects.
fs_reflowpage.h
Header file for PDF reflow page related definitions and classes.
foxit::FS_HANDLE
void * FS_HANDLE
Handle type.
Definition: fs_basictypes.h:214
foxit::common::Renderer::SetForceDownSample
void SetForceDownSample(bool is_to_force_down_sample)
Set the flag to decide whether to use down-sampling for image stretching.
foxit::common::Renderer::StartRender
Progressive StartRender(const pdf::PDFPage &page, const Matrix &matrix, PauseCallback *pause=0)
Start to render a PDF page.
foxit::common::Renderer::SetPrintTextAsImage
void SetPrintTextAsImage(bool is_to_print_text_image)
Set the flag to decide whether to print text as image.
foxit::common::Renderer::RenderFormControls
bool RenderFormControls(const pdf::PDFPage &page, const Matrix &matrix)
Render form controls.
foxit::pdf::annots::Annot
Definition: fs_annot.h:996
foxit::common::Renderer::SetRenderSignatureState
void SetRenderSignatureState(bool is_render_signature_state)
Set the flag to decide whether to draw the signature state on the signature.
foxit::Object
CFX_Object Object
Object type.
Definition: fs_basictypes.h:221
foxit::common::GraphState
Definition: fs_common.h:972
foxit::common::Renderer::SetRenderPathThinLine
void SetRenderPathThinLine(bool is_render_path_thin_line)
Set the flag to decide whether to draw path as thin line.
foxit::common::Progressive
Definition: fs_common.h:346
foxit::common::Renderer::ContentFlag
ContentFlag
Enumeration for rendering content flags.
Definition: fs_render.h:221
foxit::common::Renderer::SetRenderContentFlags
void SetRenderContentFlags(uint32 render_content_flags)
Set rendering flag to decide what content will be rendered.
fs_common.h
Header file for common definitions and classes.
foxit::ARGB
uint32 ARGB
ARGB color type, 32 bits, ((b) | ((g) << 8) | ((r) << 16)) | ((a) << 24)
Definition: fs_basictypes.h:210
foxit::common::Path
Definition: fs_common.h:2005
foxit::common::Renderer::RenderGraphicsObject
bool RenderGraphicsObject(const pdf::graphics::GraphicsObject *graphics_object, const pdf::PDFPage &page, const Matrix &matrix)
Render a graphics object.
foxit::common::Renderer::SetLayerContext
void SetLayerContext(const pdf::LayerContext &layer_context)
Set layer context to render context handle.
foxit::common::Renderer::e_DevicePrinter
Device type: printer.
Definition: fs_render.h:238
fs_pdflayer.h
Header file for PDF layer related definitions and classes.
fs_xfa.h
Header file for XFA related definitions and functions.
foxit::common::Renderer::SetRenderSignature
void SetRenderSignature(bool is_render_signature)
Set the flag to decide whether to render signatures or not.
foxit::common::Renderer::SetClipPathStroke
void SetClipPathStroke(const Path &clip_path, const Matrix &matrix, const GraphState *graph_state=0)
Set clipping path using stroked region.
foxit::pdf::LayerContext
Definition: fs_pdflayer.h:323
foxit::pdf::annots::Annot::AppearanceType
AppearanceType
Enumeration for the type of annotation's appearance.
Definition: fs_annot.h:1280
foxit::common::Renderer::DeviceType
DeviceType
Enumeration for rendering device type.
Definition: fs_render.h:234
foxit::common::Renderer::StartQuickRender
Progressive StartQuickRender(const pdf::PDFPage &page, const Matrix &matrix, PauseCallback *pause=0)
Start to quickly render a PDF page, mainly for thumbnail purpose.
foxit::pdf::graphics::GraphicsObject
Definition: fs_pdfgraphicsobject.h:241
foxit::common::Renderer::IsEmpty
bool IsEmpty() const
Check whether current object is empty or not.
foxit::common::Renderer::e_RenderPage
If set, page content will be rendered.
Definition: fs_render.h:223
foxit::common::Renderer::RenderAnnot
bool RenderAnnot(const pdf::annots::Annot &annot, const Matrix &matrix)
Render a specified annotation.
foxit::common::FillMode
FillMode
Enumeration for filling mode type, mainly for path graphics object.
Definition: fs_common.h:89
foxit::common::Renderer::SetClipRect
void SetClipRect(const RectI *clip_rect)
Set the clipping rectangle which will be used in following rendering progress.
foxit::pdf::ReflowPage
Definition: fs_reflowpage.h:62
foxit::common::Renderer::SetRenderImageAntiAliasing
void SetRenderImageAntiAliasing(bool is_render_image_antialiasing)
Set the flag to decide whether to draw image anti-aliasing.
foxit::common::Renderer::StartRenderBitmap
Progressive StartRenderBitmap(const Bitmap &bitmap, const Matrix &matrix, const RectI *clip_rect=0, uint32 interpolation=0, PauseCallback *pause=0)
Start to render a bitmap.
foxit::common::Renderer::SetClipPathFill
void SetClipPathFill(const Path &clip_path, const Matrix &matrix, foxit::common::FillMode fill_mode)
Set clipping path using filled region.
foxit
Foxit namespace.
Definition: fs_taggedpdf.h:27
foxit::common::Renderer::SetRenderEnhanceThinLines
void SetRenderEnhanceThinLines(bool is_render_enhance_thin_lines)
Set the flag to decide whether to enhance thin lines.
foxit::common::Renderer::ColorMode
ColorMode
Enumeration for rendering color mode.
Definition: fs_render.h:207
foxit::common::Renderer::SetRenderAnnotsForThumbnail
void SetRenderAnnotsForThumbnail(bool is_render_annots_for_thumbnail)
Set rendering flag to decide whether to render annotations in thumbnail mode or not.
foxit::common::Renderer::e_ColorModeMappingGray
Map gray/white/black color value to background/foreground; for other colors, no change.
Definition: fs_render.h:211
foxit::common::Renderer::e_RenderAnnot
If set, annotations will be rendered.
Definition: fs_render.h:225
IFX_Pause
Definition: fx_basic.h:3761
fs_image.h
Header file for image and bitmap related definitions and classes.
foxit::common::Renderer::SetRenderTextAntiAliasing
void SetRenderTextAntiAliasing(bool is_render_text_antialiasing)
Set the flag to decide whether to draw text anti-aliasing.
foxit::common::Renderer::SetColorMode
void SetColorMode(ColorMode color_mode)
Set color mode.
foxit::common::Renderer::SetForceHalftone
void SetForceHalftone(bool is_to_force_halftone)
Set the flag to decide whether to use halftone for image stretching.
foxit::common::Renderer::operator=
Renderer & operator=(const Renderer &other)
Assign operator.
foxit::common::Renderer::operator==
bool operator==(const Renderer &other) const
Equal operator.
NULL
#define NULL
The null-pointer value.
Definition: fx_system.h:780
foxit::pdf::PDFPage
Definition: fs_pdfpage.h:412
foxit::common::Renderer::SetPrintTextAsGraphic
void SetPrintTextAsGraphic(bool is_to_print_text_graphic)
Set the flag to decide whether to print text as path or bitmap.
foxit::common::Renderer::operator!=
bool operator!=(const Renderer &other) const
Not equal operator.
foxit::addon::xfa::XFAPage
Definition: fs_xfa.h:1237
foxit::common::Renderer::e_ColorModeNormal
Normal color mode.
Definition: fs_render.h:209
foxit::common::Renderer::SetRenderAnnotAppearanceType
void SetRenderAnnotAppearanceType(foxit::pdf::annots::Annot::AppearanceType ap_type)
Set the annotation's appearance type for rendering.
foxit::common::Renderer::~Renderer
~Renderer()
Destructor.
foxit::common::Renderer::e_ColorModeMapping
Map a color value to the color range defined by a background color and a foreground color.
Definition: fs_render.h:213
FX_RECT
Definition: fx_coordinates.h:596
CFX_Matrix
Definition: fx_coordinates.h:1076
fs_annot.h
Header file for annotation related definitions and classes.
foxit::common::Renderer::e_DeviceDisplay
Device type: display device.
Definition: fs_render.h:236
foxit::common::Renderer::SetRenderPathAntiAliasing
void SetRenderPathAntiAliasing(bool is_render_path_antialiasing)
Set the flag to decide whether to draw path anti-aliasing.
foxit::common::Bitmap
Definition: fs_image.h:36
foxit::common::Renderer::StartRenderXFAPage
Progressive StartRenderXFAPage(const addon::xfa::XFAPage &xfa_page_view, const Matrix &matrix, bool is_highlight, PauseCallback *pause=0)
Start to render an XFA page.
foxit::RectF
CFX_FloatRect RectF
Rectangle, in float.
Definition: fs_basictypes.h:451
foxit::common::Renderer::SetJPXDownSample
void SetJPXDownSample(bool is_jpx_down_sample)
Set the flag to decide whether to use down-sampling for jpx image.
foxit::uint32
FX_UINT32 uint32
32-bit unsigned integer.
Definition: fs_basictypes.h:196
foxit::common::Renderer
Definition: fs_render.h:200
foxit::common::Renderer::Renderer
Renderer(const Bitmap &bitmap, bool is_rgb_order)
Constructor, with bitmap.
foxit::Base
Definition: fs_basictypes.h:427
foxit::common::Renderer::SetJPEGDownSample
void SetJPEGDownSample(bool is_jepg_down_sample)
Set the flag to decide whether to use down-sampling for jpeg image.
foxit::common::Renderer::SetRenderPathFullCovered
void SetRenderPathFullCovered(bool is_render_path_full_covered)
A special flag that can be applied to fill mode.