Class PDFNet.PDFRasterizer
PDFNet.PDFRasterizer
Constructor Attributes | Constructor Name and Description |
---|---|
PDFRasterizer is a low-level PDF rasterizer.
|
Method Attributes | Method Name and Description |
---|---|
<static> |
PDFNet.PDFRasterizer.create(type)
PdFRasterizer constructor and destructor
|
destroy()
Frees the native memory of the object.
|
|
setAntiAliasing(enable_aa)
Enable or disable anti-aliasing.
|
|
setCaching(enabled)
enables or disables caching.
|
|
setColorPostProcessMode(mode)
Set the color post processing transformation.
|
|
setDrawAnnotations(render_annots)
Enable or disable annotation and forms rendering.
|
|
setGamma(expgamma)
sets the gamma factor used for anti-aliased rendering.
|
|
setHighlightFields(highlight)
Enable or disable highlighting form fields.
|
|
setImageSmoothing(smoothing_enabled, hq_image_resampling)
Enable or disable image smoothing.
|
|
setOCGContext(ctx)
sets the Optional Content Group (OCG) context that should be used when
rendering the page.
|
|
setOverprint(op)
enable or disable support for overprint and overprint simulation.
|
|
setPathHinting(enable_hinting)
Enable or disable path hinting.
|
|
setPrintMode(is_printing)
tells the rasterizer to render the page 'print' mode.
|
|
setRasterizerType(type)
Sets the core graphics library used for rasterization and
rendering.
|
|
setThinLineAdjustment(grid_fit, stroke_adjust)
Set thin line adjustment parameters.
|
|
this function is typically called for progressive rendering, in which
we don't want to stop the main rendering thread.
|
Class Detail
PDFNet.PDFRasterizer(id)
PDFRasterizer is a low-level PDF rasterizer.
The main purpose of this class is to convert PDF pages to raster
images (or bitmaps).
- Parameters:
- id
Method Detail
<static>
{PDFRasterizer}
PDFNet.PDFRasterizer.create(type)
PdFRasterizer constructor and destructor
- Parameters:
- {number/enum} type
- (generated enum documentation)
PDFNet.PDFRasterizer.Type = { e_BuiltIn : 0 e_GDIPlus : 1 }
- Returns:
- {PDFRasterizer} A promise that resolves to an object of type: "PDFRasterizer" (generated documentation)
destroy()
Frees the native memory of the object.
{number}
getColorPostProcessMode()
Return value enum:PDFNet.PDFRasterizer.ColorPostProcessMode = { e_postprocess_none : 0 e_postprocess_invert : 1 }
- Returns:
- {number} A promise that resolves to the current color post processing mode.
{number}
getRasterizerType()
Return value enum:PDFNet.PDFRasterizer.Type = { e_BuiltIn : 0 e_GDIPlus : 1 }
- Returns:
- {number} A promise that resolves to the type of current rasterizer.
setAntiAliasing(enable_aa)
Enable or disable anti-aliasing.
Anti-Aliasing is a technique used to improve the visual
quality of images when displaying them on low resolution
devices (for example, low DPI computer monitors).
- Parameters:
- {boolean} enable_aa
- (generated documentation)
setCaching(enabled)
enables or disables caching. Caching can improve the rendering performance in cases
where the same page will be drawn multiple times.
- Parameters:
- {boolean} enabled
- if true PDFRasterizer will cache frequently used graphics objects.
setColorPostProcessMode(mode)
Set the color post processing transformation.
This transform is applied to the rasterized bitmap as the final step
in the rasterization process, and is applied directly to the resulting
bitmap (disregarding any color space information). Color post
processing only supported for RGBA output.
- Parameters:
- {number} mode
- is the specific transform to be applied
setDrawAnnotations(render_annots)
Enable or disable annotation and forms rendering. By default, annotations and forms
are rendered.
- Parameters:
- {boolean} render_annots
- True to draw annotations, false otherwise.
setGamma(expgamma)
sets the gamma factor used for anti-aliased rendering.
- Parameters:
- {number} expgamma
- is the exponent value of gamma function. Typical values are in the range from 0.1 to 3. Gamma correction can be used to improve the quality of anti-aliased image output and can (to some extent) decrease the appearance common anti-aliasing artifacts (such as pixel width lines between polygons).
setHighlightFields(highlight)
Enable or disable highlighting form fields. Default is disabled.
- Parameters:
- {boolean} highlight
- true to highlight, false otherwise.
setImageSmoothing(smoothing_enabled, hq_image_resampling)
Enable or disable image smoothing.
The rasterizer allows a tradeoff between rendering quality and rendering speed.
This function can be used to indicate the preference between rendering speed and quality.
- Parameters:
- {boolean} smoothing_enabled
- True to enable image smoothing, false otherwise.
- {boolean} hq_image_resampling
- True to use a higher quality (but slower) smoothing algorithm
setOCGContext(ctx)
sets the Optional Content Group (OCG) context that should be used when
rendering the page. This function can be used to selectively render optional
content (such as PDF layers) based on the states of optional content groups
in the given context.
- Parameters:
- {OCGContext} ctx
- Optional Content Group (OCG) context, or NULL if the rasterizer should render all content on the page.
setOverprint(op)
enable or disable support for overprint and overprint simulation.
Overprint is a device dependent feature and the results will vary depending on
the output color space and supported colorants (i.e. CMYK, CMYK+spot, RGB, etc).
- Parameters:
- {number} op
- e_op_on: always enabled; e_op_off: always disabled; e_op_pdfx_on: enabled for PDF/X files only.
setPathHinting(enable_hinting)
Enable or disable path hinting.
- Parameters:
- {boolean} enable_hinting
- if true path hinting is enabled. Path hinting is used to slightly adjust paths in order to avoid or alleviate artifacts of hair line cracks between certain graphical elements. This option is turned on by default.
setPrintMode(is_printing)
tells the rasterizer to render the page 'print' mode. Certain page elements
(such as annotations or OCG-s) are meant to be visible either on the screen or
on the printed paper but not both. A common example, is the "Submit" button on
electronic forms.
- Parameters:
- {boolean} is_printing
- set to true is the page should be rendered in print mode.
setRasterizerType(type)
Sets the core graphics library used for rasterization and
rendering. Using this method it is possible to quickly switch
between different implementations. By default, PDFNet uses a
built-in, high-quality, and platform independent rasterizer.
- Parameters:
- {number} type
- Rasterizer type.
setThinLineAdjustment(grid_fit, stroke_adjust)
Set thin line adjustment parameters.
- Parameters:
- {boolean} grid_fit
- if true (horizontal/vertical) thin lines will be snapped to integer pixel positions. This helps make thin lines look sharper and clearer. This option is turned off by default and it only works if path hinting is enabled.
- {boolean} stroke_adjust
- if true auto stroke adjustment is enabled. Currently, this would make lines with sub-pixel width to be one-pixel wide. This option is turned on by default.
updateBuffer()
this function is typically called for progressive rendering, in which
we don't want to stop the main rendering thread. Since the rendering thread may
modify separation channels, we don't consider separations in progressive rendering.