public class RenderContext
extends java.lang.Object
RenderContext
represents the context of rendering.
The RenderContext
class defines methods to set the context of PDF
rendering.
It can be constructed by the default constructed function.
Example:
RenderContext rendercontext = RenderContext.create();
PDFPage
,
PDFReflowPage
Modifier and Type | Field and Description |
---|---|
static int |
FLAG_ANNOT
Set if page annotations to be rendered together.
|
static int |
FLAG_DROPOBJECTS
Drop page content objects when rendering page automatically.
|
static int |
FLAG_LIMITEDIMAGECACHE
Limit image cache size.
|
static int |
FLAG_NOSIGNATURE
This flag indicates not to render signatures.
|
static int |
FLAG_NOTTRANSFORMICON
Set if rotating or scaling annotation icon are not needed.
|
static int |
FLAG_NOWIDGET
Set if the form fields(widgets) are not to be rendered together.
|
static int |
FLAG_OCGDESIGN
If set this flag, only apply those content objects
which allow to output for design mode.
|
static int |
FLAG_OCGEXPORT
If set this flag, only apply those content objects
which allow to output for exportation.
|
static int |
FLAG_OCGPRINT
If set this flag, only apply those content objects
which allow to output to printer.
|
Modifier and Type | Method and Description |
---|---|
static RenderContext |
create()
Create a PDF rendering context object.
|
long |
getHandle()
Get the render context handle.
|
void |
release()
Release a PDF rendering context object.
|
void |
setFlags(int flags)
Set flags of a PDF rendering context.
|
void |
setHalftoneLimit(int halftoneLimit)
Set the halftone limit of a PDF rendering context.
|
void |
setLayerContext(LayerContext layerContext)
Set layer context to render context object.
|
void |
setMatrix(Matrix matrix)
Set a transformation matrix of a PDF rendering context.
|
void |
setOption(int option,
RenderOption renderOption)
Set option parameter of a PDF rendering context.
|
public static final int FLAG_ANNOT
public static final int FLAG_DROPOBJECTS
This will make the most complicated pages renderable within very limited
memory.
HOWEVER, after rendering a page, page content objects will
not be used anymore, and user has to re-parse page for any process on
page contents.
Do not use this flag when caller shares one rendering
context object between multi-threads.
public static final int FLAG_NOWIDGET
public static final int FLAG_NOTTRANSFORMICON
In PDF, "Text" and "FileAttachment" annotations show as icons.
public static final int FLAG_LIMITEDIMAGECACHE
This will help to save memory for a large amount of image data.
public static final int FLAG_NOSIGNATURE
public static final int FLAG_OCGPRINT
public static final int FLAG_OCGDESIGN
public static final int FLAG_OCGEXPORT
public long getHandle()
public static RenderContext create() throws PDFException
RenderContext
object to receives the newly created render
context object.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public void release() throws PDFException
PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public void setFlags(int flags) throws PDFException
flags
- Rendering flags value. All undefined bits are omitted.RENDERCONTEXTFLAG_XXX
and this can be one or a combination of these constants.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public void setMatrix(Matrix matrix) throws PDFException
matrix
- A Matrix
object which gives a transformation
matrix to render PDF content.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public void setHalftoneLimit(int halftoneLimit) throws PDFException
By default, Foxit PDF SDK displays all bitmaps using downsampling,
which means if an image is shrinked onto the screen,
only part of pixels will be picked and displayed.
This saves a lot of overhead, especially for big images
with millions of pixels. However the display quality will be bad.
In order to reach a balance between performance and quality, application
can use this function to set a limit:
if the count of pixels in an image is more than this limit, then Foxit
PDF SDK will use down-sample for quick drawing;
otherwise, if the image has less pixels, Foxit PDF SDK will use halftone
for a better quality.
halftoneLimit
- A halftone limit to a integer value. It should be above 0.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public void setOption(int option, RenderOption renderOption) throws PDFException
option
- A integer value that represents the rendering option.COLORMODE
.renderOption
- A RenderOption
object which indicates rendering
parameters for parameter option
.
If parameter option
is COLORMODE
,
this should be a RenderColorOption
object.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
RenderOption
public void setLayerContext(LayerContext layerContext) throws PDFException
layerContext
- A LayerContext
object which is a PDF layer context object.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
LayerContext