Public Types | |
enum | ColorMode { ColorMode.e_ColorModeNormal = 0, ColorMode.e_ColorModeMapping = 2 } |
Enumeration for rendering color mode. More... | |
enum | ContentFlag { ContentFlag.e_RenderPage = 0x01, ContentFlag.e_RenderAnnot = 0x02 } |
Enumeration for rendering content flags. More... | |
Public Member Functions | |
Renderer (System.Drawing.Bitmap bitmap, bool is_rgb_order) | |
Constructor, with bitmap. More... | |
Renderer (Renderer other) | |
Constructor, with another Renderer object. More... | |
bool | IsEmpty () |
Check whether current object is empty or not. More... | |
bool | RenderAnnot (Annot annot, Matrix2D matrix) |
Render a specified annotation. 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 (Path clip_path, Matrix2D matrix, FillMode fill_mode) |
Set clipping path using filled region. More... | |
void | SetClipPathStroke (Path clip_path, Matrix2D matrix, GraphState graph_state) |
Set clipping path using stroked region. More... | |
void | SetClipRect (RectI clip_rect) |
Set the clipping rectangle which will be used in following rendering progress. More... | |
void | SetColorMode (Renderer.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 | SetLayerContext (LayerContext layer_context) |
Set layer context to render context handle. More... | |
void | SetMappingModeColors (uint background_color, uint foreground_color) |
Set background color and foreground color when color mode is e_ColorModeMapping. 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 | SetRenderContentFlags (int render_content_flags) |
Set rendering flag to decide what content will be rendered. 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 | SetRenderPathAntiAliasing (bool is_render_path_antialiasing) |
Set the flag to decide whether to draw path anti-aliasing. 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 | SetRenderTextAntiAliasing (bool is_render_text_antialiasing) |
Set the flag to decide whether to draw text anti-aliasing. More... | |
void | SetTransformAnnotIcon (bool is_to_transform_annot_icon) |
Set the flag to decide whether to transform annotation icon or not when display. More... | |
Progressive | StartQuickRender (PDFPage page, Matrix2D matrix, PauseCallback pause) |
Start to quickly render a PDF page, mainly for thumbnail purpose. More... | |
Progressive | StartRender (PDFPage page, Matrix2D matrix, PauseCallback pause) |
Start to render a PDF page. More... | |
Progressive | StartRenderBitmap (System.Drawing.Bitmap bitmap, Matrix2D matrix, RectI clip_rect, int interpolation, PauseCallback pause) |
Start to render a bitmap. More... | |
Progressive | StartRenderReflowPage (ReflowPage reflow_page, Matrix2D matrix, PauseCallback pause) |
Start to render a reflow page. More... | |
Progressive | StartRenderXFAPage (XFAPage xfa_page_view, Matrix2D matrix, bool is_highlight, PauseCallback pause) |
Start to render an XFA page. More... | |
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:
|
strong |
|
strong |
|
inline |
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.
bitmap | A bitmap used for rendering. User should ensure the bitmap to keep valid until the end of life cycle of current renderer object. |
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. |
|
inline |
|
inline |
Check whether current object is empty or not.
When the current object is empty, that means current object is useless.
|
inline |
Render a specified annotation.
When this function is called, rendering flag (set by function Renderer::SetRenderContentFlags or by default) will be ignored.
annot | An Annot object to be rendered. If input annot is a pop-up annotation, this function will not render it and will return false. |
matrix | The transformation matrix used for rendering, which is usually returned by function pdf::PDFPage::GetDisplayMatrix. |
|
inline |
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.
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. |
|
inline |
Set clipping path using filled region.
clip_path | A clipping path. |
matrix | The transformation matrix used for clipping. |
fill_mode | Fill mode. It should be value e_FillModeAlternate or e_FillModeWinding. |
|
inline |
Set clipping path using stroked region.
clip_path | A clipping path. |
matrix | The transformation matrix used for clipping. |
graph_state | New graph state, for pen attributes. It can be null. |
|
inline |
Set the clipping rectangle which will be used in following rendering progress.
clip_rect | A clipping rectangle. If it is null, that means not to use clipping rectangle in following rendering progress. |
|
inline |
Set color mode.
If this function is not called, default value e_ColorModeNormal will be used.
color_mode | Color mode value. It should be one of following values: e_ColorModeNormal means normal color mode. 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". |
|
inline |
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.
is_to_force_down_sample | true means to use down-sampling for image stretching. false means not to use down-sampling for image stretching. |
|
inline |
Set the flag to decide whether to use halftone for image stretching.
If this function is not called, default value true will be used.
is_to_force_halftone | true means to use halftone for image stretching. false means not to use halftone for image stretching. |
|
inline |
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.
layer_context | A LayerContext object. |
|
inline |
Set background color and foreground color when color mode is e_ColorModeMapping.
background_color | The background color. Format: 0xAARRGGBB. |
foreground_color | The foreground color. Format: 0xAARRGGBB. |
|
inline |
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.
is_to_print_text_graphic | true means to print text as path or bitmap. false means not to print text as path or bitmap. |
|
inline |
Set the flag to decide whether to print text as image.
If this function is not called, default value false will be used.
is_to_print_text_image | true means to print text as image. false means not to print text as image. |
|
inline |
Set rendering flag to decide what content will be rendered.
If this function is not called, default value (e_RenderPage | e_RenderAnnot) will be used.
render_content_flags | Rendering content flags. Please refer to e_RenderXXX values and this should be one or a combination of these values. |
|
inline |
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.
is_render_formfield | true means to render form fields (except signature fields). false means not to render form fields (except signature fields). |
|
inline |
Set the flag to decide whether to draw image anti-aliasing.
If this function is not called, default value true will be used.
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. |
|
inline |
Set the flag to decide whether to draw path anti-aliasing.
If this function is not called, default value true will be used.
is_render_path_antialiasing | true means to draw path anti-aliasing. false means to draw path aliasing. |
|
inline |
Set the flag to decide whether to draw path as thin line.
If this function is not called, default value false will be used.
is_render_path_thin_line | true means to draw path as thin line. false means not to draw path as thin line. |
|
inline |
Set the flag to decide whether to render signatures or not.
If this function is not called, default value true will be used.
is_render_signature | true means to render signatures. false means not to render signatures. |
|
inline |
Set the flag to decide whether to draw text anti-aliasing.
If this function is not called, default value true will be used.
is_render_text_antialiasing | true means to draw text anti-aliasing. false means to draw text aliasing. |
|
inline |
Set the flag to decide whether to transform annotation icon or not when display.
The flag set by this function is only useful for note and file attachment annotations. If this function is not called, default value true will be used.
is_to_transform_annot_icon | true means to transform annotation icon when display. false means not to transform annotation icon when display. |
|
inline |
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 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.
page | A valid PDF page. It should have been parsed. |
matrix | The transformation matrix used for rendering, which is usually returned by function pdf::PDFPage::GetDisplayMatrix. |
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. |
|
inline |
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.
page | A valid PDF page. If only to render annotations (that means only 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. |
matrix | The transformation matrix used for rendering, which is usually returned by function pdf::PDFPage::GetDisplayMatrix. |
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. |
|
inline |
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.
bitmap | A valid bitmap. User should ensure the bitmap to keep valid until current rendering process is finished. |
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. |
clip_rect | Clip rectangle for the rendering device. This can be null. |
interpolation | Bitmap interpolation flags. Please refer to e_XXX values and this can be one or a combination of these values. If not specify any flag, please use 0. |
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. |
|
inline |
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.
reflow_page | A valid reflow page. It should have been parsed. |
matrix | The transformation matrix used for rendering, which is usually returned by function pdf::ReflowPage::GetDisplayMatrix. |
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. |
|
inline |
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.
xfa_page_view | A valid XFA page. |
matrix | The transformation matrix used for rendering, which is usually returned by function addon::xfa::XFAPage::GetDisplayMatrix. |
is_highlight | true means to highlight XFA widgets, and false means not to highlight XFA widgets. |
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. |