Foxit PDF SDK

Public Types | Public Member Functions | List of all members
foxit::common::Renderer Class Reference
Inheritance diagram for foxit::common::Renderer:

## Public Types
enum | ColorMode { e_ColorModeNormal = 0, e_ColorModeMappingGray = 1, e_ColorModeMapping = 2, e_ColorModeAlpha = 3, e_ColorModeForeground = 4 }
| Enumeration for rendering color mode. More...
enum | ColorModeForeground { e_ColorModeForegroundText = 0x01, e_ColorModeForegroundPath = 0x02, e_ColorModeForegroundBlackText = 0x04, e_ColorModeForegroundBlackPath = 0x08 }
| Enumeration for rendering foreground color mode. More...
enum | ContentFlag { e_RenderPage = 0x01, e_RenderAnnot = 0x02, e_RenderHighlight = 0x04, e_RenderExceptHighlight = 0x08, e_RenderScreen = 0x10 }
| Enumeration for rendering content flags. More...

## Public Member Functions
| Renderer (const Bitmap &bitmap, bool is_rgb_order)
| Constructor, with bitmap. More...
| Renderer (const PrintDeviceSettingData &print_param, const wchar_t *dest_file_path)
| Constructor for printing, with specified print device setting data. More...
| Renderer (HDC dc)
| Constructor, with specified device object. More...
| Renderer (HDC dc, const wchar_t *printer_driver_name)
| Constructor for printing, with specified printer device object and printer driver name. More...
| Renderer (const Renderer &other)
| Constructor, with another renderer object. More...
| ~Renderer ()
| Destructor.
void | ClearClips ()
| Clear the clipping rectangle set by function Renderer::SetClipRect. More...
void | EnableForPrint (bool is_render_for_print)
| Set the flag to decide whether to do rendering in print mode. More...
bool | IsEmpty () const
| Check whether current object is empty or not. More...
bool | operator != (const Renderer &other) const
| Not equal operator. More...
Renderer & | operator= (const Renderer &other)
| Assign operator. More...
bool | operator== (const Renderer &other) const
| Equal operator. More...
bool | RenderAnnot (const pdf::annots::Annot &annot, const Matrix &matrix)
| Render a specified annotation. More...
bool | RenderFormControls (const pdf::PDFPage &page, const Matrix &matrix)
| Render form controls. More...
bool | RenderGraphicsObject (const pdf::graphics::GraphicsObject *graphics_object, const pdf::PDFPage &page, const Matrix &matrix)
| Render a graphics object. More...
void | SetClearType (bool is_clear_type)
| Set the flag to decide whether to use ClearType-like anti-aliasing to render text objects. More...
void | SetClipPathFill (const Path &clip_path, const Matrix &matrix, foxit::common::FillMode fill_mode)
| Set clipping path using filled region. More...
void | SetClipPathStroke (const Path &clip_path, const Matrix &matrix, const GraphState *graph_state=0)
| Set clipping path using stroked region. More...
void | SetClipRect (const RectI *clip_rect)
| Set the clipping rectangle which will be used in subsequent rendering progress. More...
void | SetColorMode (ColorMode color_mode)
| Set color mode. More...
void | SetForceDownSample (bool is_to_force_down_sample)
| Set the flag to decide whether to use down-sampling for image stretching. More...
void | SetForceHalftone (bool is_to_force_halftone)
| Set the flag to decide whether to use halftone for image stretching. More...
void | SetForegroundColor (ARGB foreground_color)
| Set foreground color for text, path or both when color mode is Renderer::e_ColorModeForeground. More...
void | SetForegroundColorMode (uint32 foreground_color_mode)
| Set rendering foreground color mode when color mode is Renderer::e_ColorModeForeground. More...
void | SetJPEGDownSample (bool is_jepg_down_sample)
| Set the flag to decide whether to use down-sampling for jpeg image. More...
void | SetJPXDownSample (bool is_jpx_down_sample)
| Set the flag to decide whether to use down-sampling for jpx image. More...
void | SetLayerContext (const pdf::LayerContext &layer_context)
| Set layer context to render context handle. More...
void | SetMappingModeColors (ARGB background_color, ARGB foreground_color)
| Set background color and foreground color when color mode is Renderer::e_ColorModeMappingGray or Renderer::e_ColorModeMapping. More...
void | SetOverprint (bool is_to_enable_overprint)
| Set the flag to decide whether to enable overprint. More...
void | SetPrintTextAsGraphic (bool is_to_print_text_graphic)
| Set the flag to decide whether to print text as path or bitmap. More...
void | SetPrintTextAsImage (bool is_to_print_text_image)
| Set the flag to decide whether to print text as image. More...
void | SetRenderAnnotAppearanceType (foxit::pdf::annots::Annot::AppearanceType ap_type)
| Set the annotation's appearance type for rendering. More...
void | SetRenderAnnotsForThumbnail (bool is_render_annots_for_thumbnail)
| Set rendering flag to decide whether to render annotations in thumbnail mode or not. More...
void | SetRenderContentFlags (uint32 render_content_flags)
| Set rendering flag to decide what content will be rendered. More...
void | SetRenderEnhanceThinLines (bool is_render_enhance_thin_lines)
| Set the flag to decide whether to enhance thin lines. More...
void | SetRenderFormField (bool is_render_formfield)
| Set the flag to decide whether to render form fields (except signature fields). More...
void | SetRenderImageAntiAliasing (bool is_render_image_antialiasing)
| Set the flag to decide whether to draw image anti-aliasing. More...
void | SetRenderLayer (bool is_render_one_layer)
| Set the flag to decide whether to render one layer or all available layers. More...
void | SetRenderPathAntiAliasing (bool is_render_path_antialiasing)
| Set the flag to decide whether to draw path anti-aliasing. More...
void | SetRenderPathFullCovered (bool is_render_path_full_covered)
| A special flag that can be applied to fill mode. More...
void | SetRenderPathThinLine (bool is_render_path_thin_line)
| Set the flag to decide whether to draw path as thin line. More...
void | SetRenderSignature (bool is_render_signature)
| Set the flag to decide whether to render signatures or not. More...
void | SetRenderSignatureState (bool is_render_signature_state)
| Set the flag to decide whether to draw the signature state on the signature. More...
void | SetRenderTextAntiAliasing (bool is_render_text_antialiasing)
| Set the flag to decide whether to draw text anti-aliasing. More...
void | SetScreenDPIScale (float scale)
| Set the screen DPI scaling factor for rendering. More...
Progressive | StartQuickRender (const pdf::PDFPage &page, const Matrix &matrix, PauseCallback *pause=0)
| Start to quickly render a PDF page, mainly for thumbnail purpose. More...
Progressive | StartRender (const pdf::PDFPage &page, const Matrix &matrix, PauseCallback *pause=0)
| Start to render a PDF page. More...
Progressive | StartRenderBitmap (const Bitmap &bitmap, const Matrix &matrix, const RectI *clip_rect=0, uint32 interpolation=0, PauseCallback *pause=0)
| Start to render a bitmap. More...
Progressive | StartRenderBitmap (const Bitmap &bitmap, const Matrix &matrix, const RectI *clip_rect, uint32 interpolation, uint32 alpha, PauseCallback *pause)
| Start to render a bitmap. More...
Progressive | StartRenderReflowPage (const pdf::ReflowPage &reflow_page, const Matrix &matrix, PauseCallback *pause=0)
| Start to render a reflow page. More...
Progressive | StartRenderXFAPage (const addon::xfa::XFAPage &xfa_page_view, const Matrix &matrix, bool is_highlight, PauseCallback *pause=0)
| Start to render an XFA page. More...
Public Member Functions inherited from foxit::Base
FS_HANDLE | Handle () const
| Get the handle of current object. More...

## Detailed Description

PDF renderer is a graphics engine and is used to render page to a bitmap or a platform device context. This class can be constructed with a bitmap, or a device object. It offers functions to set rendering options/flags, and do rendering. In this class, there are several ways to do rendering:

- To render page and annotations, first use function Renderer::SetRenderContentFlags to decide whether to render page and annotation both or not, and then use functions Renderer::StartRender to do the rendering. Function Renderer::StartQuickRender can also be used to render page but only for thumbnail purpose.
- To render a single annotation, use function Renderer::RenderAnnot.
- To render a bitmap, use function Renderer::StartRenderBitmap.
- To render a reflow page, use function Renderer::StartRenderReflowPage.

Widget annotation is always associated with form field and form control in Foxit PDF SDK. For how to render widget annotations, here is a recommended flow:

- After loading a PDF page, first render the page and all annotations in this page (including widget annotations).
- Then, if user uses pdf::interform::Filler object to fill the form, user should use function pdf::interform::Filler::Render to render the focused form control instead of using function Renderer::RenderAnnot.

See also
  pdf::interform::Filler

## Member Enumeration Documentation

## ◆ ColorMode

enum foxit::common::Renderer::ColorMode

Enumeration for rendering color mode.

Values of this enumeration should be used alone.

Enumerator
e_ColorModeNormal | Normal color mode.
e_ColorModeMappingGray | Map gray/white/black color value to background/foreground; for other colors, no change.
e_ColorModeMapping | Map a color value to the color range defined by a background color and a foreground color.
e_ColorModeAlpha | Output alpha only, ignore color.
e_ColorModeForeground | Custom color mode. map colors to foreground.

## ◆ ColorModeForeground

enum foxit::common::Renderer::ColorModeForeground

Enumeration for rendering foreground color mode.

Values of this enumeration can be used alone or in combination.

Enumerator
e_ColorModeForegroundText | If set, the color of text need to be replaced.
e_ColorModeForegroundPath | If set, the color of path need to be replaced.
e_ColorModeForegroundBlackText | If set, only the black color of text need to be replaced.
e_ColorModeForegroundBlackPath | If set, only the black color of path need to be replaced.

## ◆ ContentFlag

enum foxit::common::Renderer::ContentFlag

Enumeration for rendering content flags.

Values of this enumeration can be used alone or in combination.

Enumerator
e_RenderPage | If set, page content will be rendered.
e_RenderAnnot | If set, annotations will be rendered.
e_RenderHighlight | If set, only highlight annotations will be rendered.
e_RenderExceptHighlight | If set, all annotations expect highlight will be rendered.
e_RenderScreen | If set, only screen annotations will be rendered.

## Constructor & Destructor Documentation

## ◆ Renderer() [1/5]

foxit::common::Renderer::Renderer | ( | const Bitmap & | bitmap,
|  | bool | is_rgb_order
| ) |  |

Constructor, with bitmap.

The input bitmap is treated as an independent device and all the content rendered by the renderer would appear in the bitmap.

Parameters

  [in] | bitmap | A bitmap used for rendering. User should ensure the bitmap to keep valid until the end of life cycle of current renderer object.
  [in] | is_rgb_order | true means Foxit PDF SDK needs to use RGB byte-order (Red is in the lowest order) when rendering. false means Foxit PDF SDK needs to use BGR byte-order (Blue is in the lowest order) when rendering.

## ◆ Renderer() [2/5]

foxit::common::Renderer::Renderer | ( | const PrintDeviceSettingData & | print_param,
|  | const wchar_t * | dest_file_path
| ) |  |

Constructor for printing, with specified print device setting data.

All the content rendered by the renderer would appear in the PDF file or PostScrip file. Generating PS files is only supported on Linux systems.

Parameters

  [in] | print_param | Setting data used to print device.
  [in] | dest_file_path | The path to generate the printed PDF file or PostScrip file. If this path is a PDF file path, please ensure Foxit PDF SDK has been initialized successfully by function common::Library::Initialize with a key including "Print2PDF" module.

## ◆ Renderer() [3/5]

foxit::common::Renderer::Renderer | ( | HDC | dc | ) |
| explicit

Constructor, with specified device object.

All the content rendered by the renderer would appear in the input device object.

Parameters

  [in] | dc | A handle of DC.

## ◆ Renderer() [4/5]

foxit::common::Renderer::Renderer | ( | HDC | dc,
|  | const wchar_t * | printer_driver_name
| ) |  |

Constructor for printing, with specified printer device object and printer driver name.

All the content rendered by the renderer would appear in the input device object.

Parameters

  [in] | dc | A handle of DC which is used for printing.
  [in] | printer_driver_name | Printer driver name. This should represent a valid printer driver and should not be an empty string.

## ◆ Renderer() [5/5]

foxit::common::Renderer::Renderer | ( | const Renderer & | other | ) |

Constructor, with another renderer object.

Parameters

  [in] | other | Another renderer object.

## Member Function Documentation

## ◆ ClearClips()

void foxit::common::Renderer::ClearClips | ( |  | ) |

Clear the clipping rectangle set by function Renderer::SetClipRect.

Returns
  None.

## ◆ EnableForPrint()

void foxit::common::Renderer::EnableForPrint | ( | bool | is_render_for_print | ) |

Set the flag to decide whether to do rendering in print mode.

Please ensure this rendering flag is set as expected when current renderer is to used for printing. For rendering annotations, if this flag is set to be true, Foxit PDF SDK will only render annotations which have annotation flag pdf::annots::Annot::e_FlagPrint.
If this function is not called for current renderer object yet, default value false will be used.

Parameters

  [in] | is_render_for_print | true means to render in print mode, while false means to render not in print mode.

Returns
  None.

## ◆ IsEmpty()

bool foxit::common::Renderer::IsEmpty | ( |  | ) | const

Check whether current object is empty or not.

When the current object is empty, that means current object is useless.

Returns
  true means current object is empty, while false means not.

## ◆ operator !=()

bool foxit::common::Renderer::operator != | ( | const Renderer & | other | ) | const

Not equal operator.

Parameters

  [in] | other | Another renderer object. This function will check if current object is not equal to this one.

Returns
  true means not equal, while false means equal.

## ◆ operator=()

Renderer& foxit::common::Renderer::operator= | ( | const Renderer & | other | ) |

Assign operator.

Parameters

  [in] | other | Another renderer object, whose value would be assigned to current object.

Returns
  Reference to current object itself.

## ◆ operator==()

bool foxit::common::Renderer::operator== | ( | const Renderer & | other | ) | const

Equal operator.

Parameters

  [in] | other | Another renderer object. This function will check if current object is equal to this one.

Returns
  true means equal, while false means not equal.

## ◆ RenderAnnot()

bool foxit::common::Renderer::RenderAnnot | ( | const pdf::annots::Annot & | annot,
|  | const Matrix & | matrix
| ) |  |

Render a specified annotation.

When this function is called, rendering flag (set by function Renderer::SetRenderContentFlags or by default) will be ignored.

Parameters

  [in] | annot | An annotation object to be rendered. If input annot is a pop-up annotation, this function will not render it and will return false.
  [in] | matrix | The transformation matrix used for rendering, which is usually returned by function pdf::PDFPage::GetDisplayMatrix.

Returns
  true means success, while false means failure.

## ◆ RenderFormControls()

bool foxit::common::Renderer::RenderFormControls | ( | const pdf::PDFPage & | page,
|  | const Matrix & | matrix
| ) |  |

Render form controls.

When this function is called, rendering flag (set by function Renderer::SetRenderContentFlags or by default) will be ignored.

Parameters

  [in] | page | A valid PDF page. If input page is invalid, this function do nothing and return false directly.
  [in] | matrix | The transformation matrix used for rendering, which is usually returned by function pdf::PDFPage::GetDisplayMatrix.

Returns
  true means success, while false means failure.

## ◆ RenderGraphicsObject()

bool foxit::common::Renderer::RenderGraphicsObject | ( | const pdf::graphics::GraphicsObject * | graphics_object,
|  | const pdf::PDFPage & | page,
|  | const Matrix & | matrix
| ) |  |

Render a graphics object.

When this function is called, rendering flag (set by function Renderer::SetRenderContentFlags or by default) will be ignored.

Parameters

  [in] | graphics_object | A valid PDF graphics object to be rendered.
  [in] | page | A valid PDF page. Parameter graphics_object belongs to this PDF page.
  [in] | matrix | The transformation matrix used for rendering, which is usually returned by function pdf::PDFPage::GetDisplayMatrix.

Returns
  true means success, while false means failure.

## ◆ SetClearType()

void foxit::common::Renderer::SetClearType | ( | bool | is_clear_type | ) |

Set the flag to decide whether to use ClearType-like anti-aliasing to render text objects.

If this function is not called, default value true will be used.

Parameters

  [in] | is_clear_type | true means to use ClearType-like anti-aliasing to render text objects. false means not to use ClearType-like anti-aliasing to render text objects.

Returns
  None.

## ◆ SetClipPathFill()

void foxit::common::Renderer::SetClipPathFill | ( | const Path & | clip_path,
|  | const Matrix & | matrix,
|  | foxit::common::FillMode | fill_mode
| ) |  |

Set clipping path using filled region.

Parameters

  [in] | clip_path | A clipping path.
  [in] | matrix | The transformation matrix used for clipping.
  [in] | fill_mode | Fill mode. It should be value e_FillModeAlternate or e_FillModeWinding.

Returns
  None.

## ◆ SetClipPathStroke()

void foxit::common::Renderer::SetClipPathStroke | ( | const Path & | clip_path,
|  | const Matrix & | matrix,
|  | const GraphState * | graph_state = `0`
| ) |  |

Set clipping path using stroked region.

Parameters

  [in] | clip_path | A clipping path.
  [in] | matrix | The transformation matrix used for clipping.
  [in] | graph_state | A valid graph state, for pen attributes. If this is NULL, Foxit PDF SDK will use a graph state object with default constructor. Default value: NULL.

Returns
  None.

## ◆ SetClipRect()

void foxit::common::Renderer::SetClipRect | ( | const RectI * | clip_rect | ) |

Set the clipping rectangle which will be used in subsequent rendering progress.

Parameters

  [in] | clip_rect | A clipping rectangle. If it is NULL, that means not to use clipping rectangle in subsequent rendering progress.

Returns
  None.

## ◆ SetColorMode()

void foxit::common::Renderer::SetColorMode | ( | ColorMode | color_mode | ) |

Set color mode.

If this function is not called, default value Renderer::e_ColorModeNormal will be used.

Parameters

  [in] | color_mode | Color mode value. It should be one of following values: Renderer::e_ColorModeNormal means normal color mode. Renderer::e_ColorModeMappingGray means to map white/black color value to background/foreground; for other colors, no change. If this mode is used, please call function Renderer::SetMappingModeColors to set "background color" and "foreground color". Renderer::e_ColorModeMapping means to map a color value to the color range defined by a background color and a foreground color. If this mode is used, please call function Renderer::SetMappingModeColors to set "background color" and "foreground color".

Returns
  None.

## ◆ SetForceDownSample()

void foxit::common::Renderer::SetForceDownSample | ( | bool | is_to_force_down_sample | ) |

Set the flag to decide whether to use down-sampling for image stretching.

If this function is not called, default value false will be used.

Parameters

  [in] | is_to_force_down_sample | true means to use down-sampling for image stretching. false means not to use down-sampling for image stretching.

Returns
  None.

## ◆ SetForceHalftone()

void foxit::common::Renderer::SetForceHalftone | ( | bool | is_to_force_halftone | ) |

Set the flag to decide whether to use halftone for image stretching.

If this function is not called, default value false will be used.

Parameters

  [in] | is_to_force_halftone | true means to use halftone for image stretching. false means not to use halftone for image stretching.

Returns
  None.

## ◆ SetForegroundColor()

void foxit::common::Renderer::SetForegroundColor | ( | ARGB | foreground_color | ) |

Set foreground color for text, path or both when color mode is Renderer::e_ColorModeForeground.

The foreground color for text, path, or both is determined by the foreground color mode set by the function Renderer::SetForegroundColorMode.

Parameters

  [in] | foreground_color | The foreground color for text, path, or both. Format: 0xAARRGGBB.

Returns
  None.

## ◆ SetForegroundColorMode()

void foxit::common::Renderer::SetForegroundColorMode | ( | uint32 | foreground_color_mode | ) |

Set rendering foreground color mode when color mode is Renderer::e_ColorModeForeground.

If this function is not called, default value (Renderer::e_ColorModeForegroundText | Renderer::e_ColorModeForegroundPath | Renderer::e_ColorModeForegroundBlackText | Renderer::e_ColorModeForegroundBlackPath) will be used.

Parameters

  [in] | foreground_color_mode | Rendering foreground color mode. Please refer to values starting from Renderer::e_ColorModeForegroundText and this should be one or a combination of these values.

Returns
  None.

## ◆ SetJPEGDownSample()

void foxit::common::Renderer::SetJPEGDownSample | ( | bool | is_jepg_down_sample | ) |

Set the flag to decide whether to use down-sampling for jpeg image.

Whether to use down-sampling for jpeg image or not will affect rendering result for a PDF page. When current function is called successfully, user should called function pdf::PDFPage::ClearRenderCache for a PDF page (which has been rendered at least once) before rendering the PDF page again.
If this function is not called, default value true will be used.

Parameters

  [in] | is_jepg_down_sample | true means to use down-sampling for jpeg image. false means not to use down-sampling for jpeg image.

Returns
  None.

## ◆ SetJPXDownSample()

void foxit::common::Renderer::SetJPXDownSample | ( | bool | is_jpx_down_sample | ) |

Set the flag to decide whether to use down-sampling for jpx image.

Whether to use down-sampling for jpx image or not will affect rendering result for a PDF page. When current function is called successfully, user should called function pdf::PDFPage::ClearRenderCache for a PDF page (which has been rendered at least once) before rendering the PDF page again.
If this function is not called, default value true will be used.

Parameters

  [in] | is_jpx_down_sample | true means to use down-sampling for jpx image. false means not to use down-sampling for jpx image.

Returns
  None.

## ◆ SetLayerContext()

void foxit::common::Renderer::SetLayerContext | ( | const pdf::LayerContext & | layer_context | ) |

Set layer context to render context handle.

In order to render one layer when PDF page's contents is rendered on a rendering context, user should call this function to set the layer context to render context.

Parameters

  [in] | layer_context | A layer context object.

Returns
  None.

## ◆ SetMappingModeColors()

void foxit::common::Renderer::SetMappingModeColors | ( | ARGB | background_color,
|  | ARGB | foreground_color
| ) |  |

Set background color and foreground color when color mode is Renderer::e_ColorModeMappingGray or Renderer::e_ColorModeMapping.

Parameters

  [in] | background_color | The background color. Format: 0xAARRGGBB.
  [in] | foreground_color | The foreground color. Format: 0xAARRGGBB.

Returns
  None.

## ◆ SetOverprint()

void foxit::common::Renderer::SetOverprint | ( | bool | is_to_enable_overprint | ) |

Set the flag to decide whether to enable overprint.

Parameters

  [in] | is_to_enable_overprint | true means to enable overprint. false means not to enable overprint. Default: false.

Returns
  None.

## ◆ SetPrintTextAsGraphic()

void foxit::common::Renderer::SetPrintTextAsGraphic | ( | bool | is_to_print_text_graphic | ) |

Set the flag to decide whether to print text as path or bitmap.

When this flag is true, Foxit PDF SDK will render text in different way: if font size is greater than 50, print text as path; otherwise, print text as bitmap.
If this function is not called, default value false will be used.

Parameters

  [in] | is_to_print_text_graphic | true means to print text as path or bitmap. false means not to print text as path or bitmap.

Returns
  None.

## ◆ SetPrintTextAsImage()

void foxit::common::Renderer::SetPrintTextAsImage | ( | bool | is_to_print_text_image | ) |

Set the flag to decide whether to print text as image.

If this function is not called, default value false will be used.

Parameters

  [in] | is_to_print_text_image | true means to print text as image. false means not to print text as image.

Returns
  None.

## ◆ SetRenderAnnotAppearanceType()

void foxit::common::Renderer::SetRenderAnnotAppearanceType | ( | foxit::pdf::annots::Annot::AppearanceType | ap_type | ) |

Set the annotation's appearance type for rendering.

Parameters

  [in] | ap_type | Type of annotation's appearance. Please refer to values starting from pdf::annots::Annot::e_AppearanceTypeNormal and this should be one of these values.

Returns
  None.

## ◆ SetRenderAnnotsForThumbnail()

void foxit::common::Renderer::SetRenderAnnotsForThumbnail | ( | bool | is_render_annots_for_thumbnail | ) |

Set rendering flag to decide whether to render annotations in thumbnail mode or not.

In thumbnail mode, the flags of annotations, "NoZoom" and "NoRotate", will be ignored. This rendering flag is available only when flag Renderer::e_RenderAnnot is used for rendering or function Renderer::RenderAnnot is called. Please refer to function Renderer::SetRenderContentFlags about setting flag Renderer::e_RenderAnnot.
If this function is not called, default value false will be used when this rendering flag is available.

Parameters

  [in] | is_render_annots_for_thumbnail | true means to render annotations in thumbnail mode. false means not to render annotations in thumbnail mode.

Returns
  None.

## ◆ SetRenderContentFlags()

void foxit::common::Renderer::SetRenderContentFlags | ( | uint32 | render_content_flags | ) |

Set rendering flag to decide what content will be rendered.

If this function is not called, default value (Renderer::e_RenderPage | Renderer::e_RenderAnnot) will be used.

Parameters

  [in] | render_content_flags | Rendering content flags. Please refer to values starting from Renderer::e_RenderPage and this should be one or a combination of these values. The Renderer::e_RenderHighlight can not be combined with Renderer::e_RenderExceptHighlight.

Returns
  None.

## ◆ SetRenderEnhanceThinLines()

void foxit::common::Renderer::SetRenderEnhanceThinLines | ( | bool | is_render_enhance_thin_lines | ) |

Set the flag to decide whether to enhance thin lines.

If this function is not called, default value false will be used.

Parameters

  [in] | is_render_enhance_thin_lines | true means to draw zero width lines with a thicker path so they are more visible than the default single pixel. false means to draw zero width lines with a single pixel width.

Returns
  None.

## ◆ SetRenderFormField()

void foxit::common::Renderer::SetRenderFormField | ( | bool | is_render_formfield | ) |

Set the flag to decide whether to render form fields (except signature fields).

If this function is not called, default value true will be used when this flag is available.

Parameters

  [in] | is_render_formfield | true means to render form fields (except signature fields). false means not to render form fields (except signature fields).

Returns
  None.

## ◆ SetRenderImageAntiAliasing()

void foxit::common::Renderer::SetRenderImageAntiAliasing | ( | bool | is_render_image_antialiasing | ) |

Set the flag to decide whether to draw image anti-aliasing.

If this function is not called, default value true will be used.

Parameters

  [in] | is_render_image_antialiasing | true means to draw image anti-aliasing, and the effect would be similar to values defined in enum class InterpolationFlag. false means to draw image aliasing.

Returns
  None.

## ◆ SetRenderLayer()

void foxit::common::Renderer::SetRenderLayer | ( | bool | is_render_one_layer | ) |

Set the flag to decide whether to render one layer or all available layers.

If this function is not called, default value true will be used when this flag is available.

Parameters

  [in] | is_render_one_layer | true means to render one layer. false means to render all available layers.

Returns
  None.

## ◆ SetRenderPathAntiAliasing()

void foxit::common::Renderer::SetRenderPathAntiAliasing | ( | bool | is_render_path_antialiasing | ) |

Set the flag to decide whether to draw path anti-aliasing.

If this function is not called, default value true will be used.

Parameters

  [in] | is_render_path_antialiasing | true means to draw path anti-aliasing. false means to draw path aliasing.

Returns
  None.

## ◆ SetRenderPathFullCovered()

void foxit::common::Renderer::SetRenderPathFullCovered | ( | bool | is_render_path_full_covered | ) |

A special flag that can be applied to fill mode.

If this function is not called, default value false will be used.

Parameters

  [in] | is_render_path_full_covered | true means that all pixels partially covered by the path will be fully painted, while false means not.

Returns
  None.

## ◆ SetRenderPathThinLine()

void foxit::common::Renderer::SetRenderPathThinLine | ( | bool | is_render_path_thin_line | ) |

Set the flag to decide whether to draw path as thin line.

If this function is not called, default value false will be used.

Parameters

  [in] | is_render_path_thin_line | true means to draw path as thin line. false means not to draw path as thin line.

Returns
  None.

## ◆ SetRenderSignature()

void foxit::common::Renderer::SetRenderSignature | ( | bool | is_render_signature | ) |

Set the flag to decide whether to render signatures or not.

If this function is not called, default value true will be used when this flag is available.

Parameters

  [in] | is_render_signature | true means to render signatures. false means not to render signatures.

Returns
  None.

## ◆ SetRenderSignatureState()

void foxit::common::Renderer::SetRenderSignatureState | ( | bool | is_render_signature_state | ) |

Set the flag to decide whether to draw the signature state on the signature.

If this function is not called, default value true will be used.

Parameters

  [in] | is_render_signature_state | true means to draw the signature state on the signature, while false means not.

## ◆ SetRenderTextAntiAliasing()

void foxit::common::Renderer::SetRenderTextAntiAliasing | ( | bool | is_render_text_antialiasing | ) |

Set the flag to decide whether to draw text anti-aliasing.

If this function is not called, default value true will be used.

Parameters

  [in] | is_render_text_antialiasing | true means to draw text anti-aliasing. false means to draw text aliasing.

Returns
  None.

## ◆ SetScreenDPIScale()

void foxit::common::Renderer::SetScreenDPIScale | ( | float | scale | ) |

Set the screen DPI scaling factor for rendering.

Set the screen DPI scaling scale to adapt to different DPI conditions. This value should typically match the system-reported scaling factor (e.g., 1.25f for 125% scaling in display settings) to ensure proper rendering alignment with the physical display characteristics.

Parameters

  [in] | scale | The scale of curren screen DPI(1.0f = 100% native DPI, 2.0f = 200%, etc.). Must be greater than 0 and should generally correspond to the system's recommended scaling factor. Default value: 1.0f for non-Android platforms; 2.5f for Android platform.

Note
  Currently, this screen DPI scaling factor only affects the annotations.

Returns
  None.

## ◆ StartQuickRender()

Progressive foxit::common::Renderer::StartQuickRender | ( | const pdf::PDFPage & | page,
|  | const Matrix & | matrix,
|  | PauseCallback * | pause = `0`
| ) |  |

Start to quickly render a PDF page, mainly for thumbnail purpose.

This function is mainly used for render a page for thumbnail purpose. The rendered content will not be completed: all the annotations will be ignored, event if flag Renderer::e_RenderAnnot is set by function Renderer::SetRenderContentFlags; text content will become blurred and will be replace by pixel point.
It may still take a long time to do this quick rendering when page has complex or large contents, so Foxit PDF SDK uses a progressive process to do this.

Parameters

  [in] | page | A valid PDF page. It should have been parsed.
  [in] | matrix | The transformation matrix used for rendering, which is usually returned by function pdf::PDFPage::GetDisplayMatrix.
  [in] | pause | Pause callback object which decides if the rendering process needs to be paused. This can be NULL which means not to pause during the rendering process. If this is not NULL, it should be a valid pause object implemented by user. Default value: NULL.

Returns
  A progressive object. Please check the rate of current progress by function Progressive::GetRateOfProgress. If the rate is not 100 yet, call function Progressive::Continue to continue the progress until the progress is finished.

## ◆ StartRender()

Progressive foxit::common::Renderer::StartRender | ( | const pdf::PDFPage & | page,
|  | const Matrix & | matrix,
|  | PauseCallback * | pause = `0`
| ) |  |

Start to render a PDF page.

It may take a long time to render a PDF page with complex or large contents, so Foxit PDF SDK uses a progressive process to do this.
Widget annotation is always associated with form field and form control in Foxit PDF SDK. For how to render widget annotations, here is a recommended flow:

- After loading a PDF page, first render the page and all annotations in this page (including widget annotations).
- Then, if user uses pdf::interform::Filler object to fill the form, user should use function pdf::interform::Filler::Render to render the focused form control instead of using function Renderer::RenderAnnot.

Parameters

  [in] | page | A valid PDF page. If only to render annotations (that means only Renderer::e_RenderAnnot is set by function Renderer::SetRenderContentFlags), there is no need to parse the input page; otherwise the input page should have been parsed.
  [in] | matrix | The transformation matrix used for rendering, which is usually returned by function pdf::PDFPage::GetDisplayMatrix.
  [in] | pause | Pause callback object which decides if the rendering process needs to be paused. This can be NULL which means not to pause during the rendering process. If this is not NULL, it should be a valid pause object implemented by user. Default value: NULL.

Returns
  A progressive object. Please check the rate of current progress by function Progressive::GetRateOfProgress. If the rate is not 100 yet, call function Progressive::Continue to continue the progress until the progress is finished.

## ◆ StartRenderBitmap() [1/2]

Progressive foxit::common::Renderer::StartRenderBitmap | ( | const Bitmap & | bitmap,
|  | const Matrix & | matrix,
|  | const RectI * | clip_rect = `0`,
|  | uint32 | interpolation = `0`,
|  | PauseCallback * | pause = `0`
| ) |  |

Start to render a bitmap.

It may take a long time to render a bitmap with complex or large contents, so Foxit PDF SDK uses a progressive process to do this.

Parameters

  [in] | bitmap | A valid bitmap. User should ensure the bitmap to keep valid until current rendering process is finished.
  [in] | matrix | The transformation matrix used for rendering. This matrix is used as image matrix: assume that h is image height, w is image width, and then matrix [w 0 0 h 0 0] will produce an identical image.
  [in] | clip_rect | Clip rectangle for the rendering device. This can be NULL. Default value: NULL.
  [in] | interpolation | Bitmap interpolation flags. Please refer to values starting from Bitmap::e_Downsample and this can be one or a combination of these values. If not specify any flag, please use 0. Default value: 0.
  [in] | pause | Pause callback object which decides if the rendering process needs to be paused. This can be NULL which means not to pause during the rendering process. If this is not NULL, it should be a valid pause object implemented by user. Default value: NULL.

Returns
  A progressive object. Please check the rate of current progress by function Progressive::GetRateOfProgress. If the rate is not 100 yet, call function Progressive::Continue to continue the progress until the progress is finished.

## ◆ StartRenderBitmap() [2/2]

Progressive foxit::common::Renderer::StartRenderBitmap | ( | const Bitmap & | bitmap,
|  | const Matrix & | matrix,
|  | const RectI * | clip_rect,
|  | uint32 | interpolation,
|  | uint32 | alpha,
|  | PauseCallback * | pause
| ) |  |

Start to render a bitmap.

It may take a long time to render a bitmap with complex or large contents, so Foxit PDF SDK uses a progressive process to do this.

Parameters

  [in] | bitmap | A valid bitmap. User should ensure the bitmap to keep valid until current rendering process is finished.
  [in] | matrix | The transformation matrix used for rendering. This matrix is used as image matrix: assume that h is image height, w is image width, and then matrix [w 0 0 h 0 0] will produce an identical image.
  [in] | clip_rect | Clip rectangle for the rendering device. This can be NULL.
  [in] | interpolation | Bitmap interpolation flags. Please refer to values starting from Bitmap::e_Downsample and this can be one or a combination of these values. If not specify any flag, please use 0.
  [in] | alpha | Bitmap alpha represents transparency (0 = fully transparent, 255 = fully opaque). Valid range: from 0 to 255.
  [in] | pause | Pause callback object which decides if the rendering process needs to be paused. This can be NULL which means not to pause during the rendering process. If this is not NULL, it should be a valid pause object implemented by user.

Returns
  A progressive object. Please check the rate of current progress by function Progressive::GetRateOfProgress. If the rate is not 100 yet, call function Progressive::Continue to continue the progress until the progress is finished.

## ◆ StartRenderReflowPage()

Progressive foxit::common::Renderer::StartRenderReflowPage | ( | const pdf::ReflowPage & | reflow_page,
|  | const Matrix & | matrix,
|  | PauseCallback * | pause = `0`
| ) |  |

Start to render a reflow page.

It may take a long time to render a reflow page with complex or large contents, so Foxit PDF SDK uses a progressive process to do this.

Parameters

  [in] | reflow_page | A valid reflow page. It should have been parsed.
  [in] | matrix | The transformation matrix used for rendering, which is usually returned by function pdf::ReflowPage::GetDisplayMatrix.
  [in] | pause | Pause callback object which decides if the rendering process needs to be paused. This can be NULL which means not to pause during the rendering process. If this is not NULL, it should be a valid pause object implemented by user. Default value:NULL.

Returns
  A progressive object. Please check the rate of current progress by function Progressive::GetRateOfProgress. If the rate is not 100 yet, call function Progressive::Continue to continue the progress until the progress is finished.

## ◆ StartRenderXFAPage()

Progressive foxit::common::Renderer::StartRenderXFAPage | ( | const addon::xfa::XFAPage & | xfa_page_view,
|  | const Matrix & | matrix,
|  | bool | is_highlight,
|  | PauseCallback * | pause = `0`
| ) |  |

Start to render an XFA page.

It will take a long time to render an XFA page with complex or large contents, so Foxit PDF SDK uses a progressive process to do this.

Parameters

  [in] | xfa_page_view | A valid XFA page.
  [in] | matrix | The transformation matrix used for rendering, which is usually returned by function addon::xfa::XFAPage::GetDisplayMatrix.
  [in] | is_highlight | true means to highlight XFA widgets, and false means not to highlight XFA widgets.
  [in] | pause | Pause callback object which decides if the rendering process needs to be paused. This can be NULL which means not to pause during the rendering process. If this is not NULL, it should be a valid pause object implemented by user. Default value: NULL.

Returns
  A progressive object. Please check the rate of current progress by function Progressive::GetRateOfProgress. If the rate is not 100 yet, call function Progressive::Continue to continue the progress until the progress is finished.