java.lang.Object | ||||
↳ | java.awt.Component | |||
↳ | java.awt.Container | |||
↳ | javax.swing.JComponent | |||
↳ | com.pdftron.pdf.PDFViewCtrl |
PDFViewCtrl is a utility class that can be used for interactive rendering of PDF documents.
In .NET environment PDFViewCtrl is derived from System.Windows.Forms.Control and it can be used like a regular form (see PDFViewForm.cs in PDFView sample for C# for a concrete example).
PDFViewCtrl implements some essential features such as double-buffering, multi-threaded rendering, scrolling, zooming, and page navigation that are essential in interactive rendering applications (e.g. in client PDF viewing and editing applications).
PDFView defines several coordinate spaces and it is important to understand their differences:
SINGLE_CONTINUOUS
,
all the pages are arranged
vertically with one page in each row, and therefore the Canvas Space is
rectangle with possibly large height value. For this reason, Canvas Space is
also, like Page Space, independent of the zoom factor. Also note that since
PDFView adds gaps between adjacent pages, the Canvas Space is larger than the
space occupied by all the pages. The origin of the Canvas Space is located at
the upper-left corner.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
enum | PDFViewCtrl.ColorPostprocessMode | ||||||||||
class | PDFViewCtrl.LinkInfo | A class that holds information for a link. | |||||||||
enum | PDFViewCtrl.PagePresentationMode | PagePresentationMode lists common modes of presenting PDF pages. | |||||||||
enum | PDFViewCtrl.PageViewMode | PageViewMode lists common modes of viewing PDF pages. | |||||||||
class | PDFViewCtrl.Selection | A class representing the current text selection. |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | e_AnnotMgr_Admin_undoOthers | ||||||||||
int | e_AnnotMgr_Admin_undoOwn | ||||||||||
int | e_AnnotMgr_UserOnly | ||||||||||
int | e_custom | PDFViewCtrl class supports a number of 'built-in' tool modes. | |||||||||
int | e_facing |
This constant is deprecated.
use FACING instead.
|
|||||||||
int | e_facing_continuous |
This constant is deprecated.
use FACING_CONTINUOUS instead.
|
|||||||||
int | e_facing_continuous_cover |
This constant is deprecated.
use FACING_CONTINUOUS_COVER instead.
|
|||||||||
int | e_facing_cover |
This constant is deprecated.
use FACING_COVER instead.
|
|||||||||
int | e_fit_height |
This constant is deprecated.
use FIT_HEIGHT instead.
|
|||||||||
int | e_fit_page |
This constant is deprecated.
use FIT_PAGE instead.
|
|||||||||
int | e_fit_width |
This constant is deprecated.
use FIT_WIDTH instead.
|
|||||||||
int | e_pan | The Constant e_pan. | |||||||||
int | e_postprocess_invert |
This constant is deprecated.
use INVERT instead.
|
|||||||||
int | e_postprocess_none |
This constant is deprecated.
use NONE instead.
|
|||||||||
int | e_single_continuous |
This constant is deprecated.
use SINGLE_CONTINUOUS instead.
|
|||||||||
int | e_single_page |
This constant is deprecated.
use SINGLE_PAGE instead.
|
|||||||||
int | e_text_rect_select | The Constant e_text_rect_select. | |||||||||
int | e_text_struct_select | The Constant e_text_struct_select. | |||||||||
int | e_zoom |
This constant is deprecated.
use ZOOM instead.
|
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
javax.swing.JComponent
| |||||||||||
From class
java.awt.Component
| |||||||||||
From interface
java.awt.image.ImageObserver
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
PDFViewCtrl()
PDFViewCtrl constructor.
| |||||||||||
PDFViewCtrl(int preferred_width)
Instantiates a new PDFViewCtrl.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int |
GetSelectionBeginPage()
this method returns the first page number that has text selection on it.
| ||||||||||
int |
GetSelectionEndPage()
this method returns the last page number that has text selection on it.
| ||||||||||
boolean |
HasSelectionOnPage(int page)
Checks for selection on page.
| ||||||||||
boolean |
canRedo()
Returns true if redo operation is available.
| ||||||||||
boolean |
canUndo()
Returns true if Undo operation is available.
| ||||||||||
void | cancelAllThumbRequests() | ||||||||||
void |
cancelRendering()
Cancels rendering in progress.
| ||||||||||
void |
cancelRenderingAsync()
Cancels rendering in progress and returns immediately, potentially before
rendering has actually stopped.
| ||||||||||
void |
clearSelection()
Remove any text selection.
| ||||||||||
void |
close()
Frees the native memory of the object.
| ||||||||||
Point2D.Double |
convCanvasPtToPagePt(double x, double y, int page_num)
Convert a point in canvas space to a point in a page space.
| ||||||||||
Point2D.Double |
convCanvasPtToPagePt(double x, double y)
Convert a point expressed in canvas space to a point in the current page
space.
| ||||||||||
Point2D.Double |
convCanvasPtToScreenPt(double x, double y)
Convert a point expressed in canvas space to a point in screen space.
| ||||||||||
Point2D.Double |
convPagePtToCanvasPt(double x, double y, int page_num)
Convert a point in page space to a point in canvas space.
| ||||||||||
Point2D.Double |
convPagePtToCanvasPt(double x, double y)
Convert a point in a page space to a point in canvas space.
| ||||||||||
Point2D.Double |
convPagePtToScreenPt(double x, double y)
Convert a point from a page space to screen space.
| ||||||||||
Point2D.Double |
convPagePtToScreenPt(double x, double y, int page_num)
Convert a point from a page space to a point in screen space.
| ||||||||||
Point2D.Double |
convScreenPtToCanvasPt(double x, double y)
Convert a point expressed in screen space to a point in canvas space.
| ||||||||||
Point2D.Double |
convScreenPtToPagePt(double x, double y, int page_num)
Convert a point expressed in screen space to a point in a page space.
| ||||||||||
Point2D.Double |
convScreenPtToPagePt(double x, double y)
Convert a point expressed in screen space to the current page space.
| ||||||||||
void |
destroy()
Frees the native memory of the object.
| ||||||||||
void |
docLock(boolean cancel_thread)
Acquires a write lock on the currently open document,
optionally canceling all threads accessing the document.
| ||||||||||
void |
docLockRead()
Locks the currently open document to prevent competing write threads
(using Lock()) from accessing the document at the same time.
| ||||||||||
boolean |
docTryLock(int milliseconds)
Try acquiring a write lock on the currently open document, waiting no
longer than specified number of milliseconds.
| ||||||||||
boolean |
docTryLockRead(int milliseconds)
Try acquiring a read lock on the current document, waiting no longer than specified
number of milliseconds.
| ||||||||||
void |
docUnlock()
Releases the write lock from the currently open document.
| ||||||||||
void |
docUnlockRead()
Releases the read lock from the currently open document.
| ||||||||||
void |
enableUndoRedo()
Enable Undo/Redo in this PDFview.
| ||||||||||
void |
findTextAsync(String search_str, boolean match_case, boolean match_whole_word, boolean search_up, boolean reg_exp)
Selects text by searching for a given string of text asynchronously, and
calling a user callback upon completion
| ||||||||||
Annot |
getAnnotationAt(int x, int y)
Gets the annotation at the (x, y) position expressed in screen coordinates.
| ||||||||||
Annot |
getAnnotationAt(int x, int y, double distanceThreshold, double minimumLineWeight)
Gets the annotation at the (x, y) position expressed in screen coordinates.
| ||||||||||
Annot[] |
getAnnotationListAt(int x1, int y1, int x2, int y2)
Gets the list of annotations at line (x1, y1, x2, y2) expressed in screen coordinates *
| ||||||||||
Annot[] |
getAnnotationsOnPage(int page_num)
Gets the list of annotations on a given page.
| ||||||||||
int |
getBufferHeight()
Get the width of the rendering buffer in pixels.
| ||||||||||
int |
getBufferStride()
Get the stride of the rendering buffer in pixels.
| ||||||||||
int |
getBufferWidth()
Get the width of the rendering buffer in pixels.
| ||||||||||
double |
getCanvasHeight()
Returns the height of the scrollable space.
| ||||||||||
double |
getCanvasWidth()
Returns the width of the scrollable space.
| ||||||||||
int | getColorPostProcessMode() | ||||||||||
int |
getCurrentPage()
Get the current page.
| ||||||||||
Matrix2D |
getDeviceTransform(int page_num)
Get the device transform matrix
| ||||||||||
Matrix2D |
getDeviceTransform()
Get the device transformation matrix
Note: to obtain a transformation matrix that maps screen coordinates to page coordinates, you can invert the device matrix. | ||||||||||
PDFDoc |
getDoc()
Get the document.
| ||||||||||
ExternalAnnotManager |
getExternalAnnotManager(String author_name)
Get the external annot manager belonging to this PDFViewCtrl
| ||||||||||
ExternalAnnotManager |
getExternalAnnotManager(String author_name, int mode)
Get the external annot manager belonging to this PDFViewCtrl
| ||||||||||
int | getH() | ||||||||||
double | getHScrollPos() | ||||||||||
int | getHeight() | ||||||||||
PDFViewCtrl.LinkInfo |
getLinkAt(int x, int y)
Gets the link info at a given point, specified in client space.
| ||||||||||
String |
getNextRedoInfo()
Returns any meta-data associated with the next sate in the undo chain.
| ||||||||||
String |
getNextUndoInfo()
Returns any meta-data associated with the previous sate in the undo chain.
| ||||||||||
Context |
getOCGContext()
Get the oCG context.
| ||||||||||
int |
getPageCount()
Get the page count.
| ||||||||||
int |
getPageNumberFromScreenPt(double x, double y)
Get the page number from screen pt.
| ||||||||||
int |
getPagePresentationMode()
Get the page presentation mode.
| ||||||||||
int |
getPageViewMode()
Get the page view mode.
| ||||||||||
Dimension | getPreferredScrollableViewportSize() | ||||||||||
Dimension | getPreferredSize() | ||||||||||
int |
getRotation()
Get the rotation.
| ||||||||||
Rect |
getScreenRectForAnnot(Annot annot, int page_num)
Gets annotation bounding box in screen points
| ||||||||||
int | getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) | ||||||||||
boolean | getScrollableTracksViewportHeight() | ||||||||||
boolean | getScrollableTracksViewportWidth() | ||||||||||
int | getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) | ||||||||||
PDFViewCtrl.Selection |
getSelection(int page)
Get the selection.
| ||||||||||
Dimension | getSize(Dimension rv) | ||||||||||
void | getThumbAsync(int page_num, ThumbAsyncHandler proc, Object data) | ||||||||||
int |
getToolMode()
Get the tool mode.
| ||||||||||
int | getV() | ||||||||||
double | getVScrollPos() | ||||||||||
PDFViewScrollPane | getViewPane() | ||||||||||
int | getWidth() | ||||||||||
double |
getZoom()
Get the current zoom factor.
| ||||||||||
boolean |
gotoFirstPage()
Set the current page to the first page in the document.
| ||||||||||
boolean |
gotoLastPage()
Set the current page to the last page in the document.
| ||||||||||
boolean |
gotoNextPage()
Set the current page to the next page in the document.
| ||||||||||
boolean |
gotoPreviousPage()
Set the current page to the previous page in the document.
| ||||||||||
boolean |
hasSelection()
Checks for selection.
| ||||||||||
void |
hideAnnotation(Annot annot)
Disable rendering of a particular annotation.
| ||||||||||
void |
invalidateRect(Rect rect)
Invalidate rect.
| ||||||||||
void |
invalidateRect()
The InvalidateRect function adds a rectangle to the buffer/window update
region.
| ||||||||||
boolean | isFinishedRendering() | ||||||||||
void |
onScroll(int pix_dx, int pix_dy)
Scrolls the contents of the rendering buffer 'pix_dx' horizontally and
'pix_dy' vertically.
| ||||||||||
String |
redo()
Go to the next state in the undo/redo chain.
| ||||||||||
void |
refreshAndUpdate(ViewChangeCollection view_change)
Helper function that will refresh annotation and/or field appearances if needed, and then
render modified page areas, all based on the contents of the view_change parameter.
| ||||||||||
void |
revertAllChanges()
Determine whether this DocumentConversion has progress reporting capability.
| ||||||||||
void |
rotateClockwise()
Rotates all pages in the document 90 degrees clockwise.
| ||||||||||
void |
rotateCounterClockwise()
Rotates all pages in the document 90 degrees counter-clockwise.
| ||||||||||
void | scrollRectToVisible(Rectangle r) | ||||||||||
void |
selectAll()
Selects all text on the page.
| ||||||||||
boolean |
selectByHighlights(Highlights hlts)
Selects texts by Highlights.
| ||||||||||
boolean |
selectByRect(double x1, double y1, double x2, double y2)
Selects all words that intersect the given selection rectangle.
| ||||||||||
boolean |
selectBySelection(PDFViewCtrl.Selection sel)
Selects texts by PDFViewCtrl.Selection.
| ||||||||||
boolean |
selectByStruct(double x1, double y1, double x2, double y2)
Selects text taking into account page logical structure.
| ||||||||||
void |
setAntiAliasing(boolean enable_aa)
Enable or disable anti-aliasing.
| ||||||||||
void |
setBackground(Color c)
Set the default background color used to paint the area surrounding each
page.
| ||||||||||
void |
setBackgroundColor(byte r, byte g, byte b)
Set the default background color used to paint the area surrounding each
page.
| ||||||||||
void |
setCaching(boolean enabled)
Enables or disables caching.
| ||||||||||
void |
setColorPostProcessMode(int mode)
This method is deprecated.
use #setColorPostprocessMode()ColorPostprocessMode instead.
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.
| ||||||||||
void |
setColorPostProcessMode(PDFViewCtrl.ColorPostprocessMode mode)
Set the color post processing transformation.
| ||||||||||
boolean |
setCurrentPage(int page_num)
Set the current page to the given page.
| ||||||||||
void |
setCurrentPageProc(CurrentPageProc curr_pagenum_proc, Object data)
Set the callback function (i.e.
| ||||||||||
void |
setDefaultPageColor(byte r, byte g, byte b)
Set the default 'paper' color used to draw background of each page.
| ||||||||||
void |
setDefaultPageColor(Color c)
Set the default 'paper' color used to draw background of each page.
| ||||||||||
void |
setDevicePixelDensity(double dpi, double scale_factor)
Set device DPI, and scale factor.
| ||||||||||
void |
setDoc(PDFDoc doc)
Associates this PDFViewCtrl with a given PDF document.
| ||||||||||
void |
setDrawAnnotations(boolean render_annots)
Enable or disable annotation and forms rendering.
| ||||||||||
void |
setErrorReportProc(ErrorReportProc error_proc, Object data)
Set the error report process
| ||||||||||
void |
setFieldHighlightColor(ColorPt cp)
Set the highlight color for fields
This option only has an effect if field highlighting is turned on using
`setHighlightFields(true)`.
| ||||||||||
void |
setFindTextHandler(FindTextProc proc, Object data)
Set the callback function (i.e.
| ||||||||||
void |
setGamma(double exp)
Set the gamma factor used for anti-aliased rendering.
| ||||||||||
void | setH(int h) | ||||||||||
void |
setHScrollPos(double pos)
Sets the horizontal scroll position in the scrollable space..
| ||||||||||
void |
setHighlightFields(boolean highlight_fields)
Enable or disable highlighting form fields.
| ||||||||||
void |
setHorizontalAlign(int align)
Set the horizontal alignment used for rendering pages within the view.
| ||||||||||
void |
setImageSmoothing(boolean smoothing_enabled)
Set the image smoothing.
| ||||||||||
void |
setImageSmoothing()
Enable or disable image smoothing.
| ||||||||||
void |
setOCGContext(Context ctx)
Set the Optional Content Group (OCG) context that should be used when
viewing the document.
| ||||||||||
void |
setOverprint(int op)
Enable or disable support for overprint.
| ||||||||||
void |
setPageBorderVisibility(boolean border_visible)
Enables or disables drawing of a thin border around each page.
| ||||||||||
void |
setPagePresentationMode(PDFViewCtrl.PagePresentationMode mode)
Set the current page presentation mode.
| ||||||||||
void |
setPagePresentationMode(int mode)
This method is deprecated.
use
setPagePresentationMode(PagePresentationMode) instead.
Set the current page presentation mode. | ||||||||||
void |
setPageSpacing(int horiz_col_space, int vert_col_space, int horiz_pad, int vert_pad)
Set the vertical and horizontal padding and column spacing between
adjacent pages in the view.
| ||||||||||
void |
setPageTransparencyGrid(boolean trans_grid_visible)
Enables or disables the transparency grid (check board pattern) to
reflect page transparency.
| ||||||||||
void |
setPageViewMode(PDFViewCtrl.PageViewMode mode)
Set the page viewing mode.
| ||||||||||
void |
setPageViewMode(int mode)
This method is deprecated.
use
setPageViewMode(PageViewMode) instead.
Set the page viewing mode.
Note: The default PageView mode is e_fit_width. | ||||||||||
void |
setPathHinting(boolean enable_ph)
Enable or disable path hinting.
| ||||||||||
void |
setPreferredSize(int width, int height)
Set the preferred size.
| ||||||||||
void | setPreferredSize(Dimension d) | ||||||||||
void |
setProgressiveRendering(boolean is_progressive)
Enables or disables progressive rendering in PDFViewCtrl.
| ||||||||||
void |
setRasterizer(boolean builtin_rasterizer)
Set the core graphics library used for rasterization and rendering.
| ||||||||||
void |
setRequestRenderInWorkerThreadProc(RequestRenderInWorkerThreadProc render_worker_proc, Object data)
Sets the RequestRenderInWorkerThread Callback
| ||||||||||
void |
setRequiredFieldBorderColor(ColorPt cp)
Set the border color for required fields
This option only has an effect if field highlighting is turned on using
`setHighlightFields(true)`.
| ||||||||||
void |
setSignatureHighlightColor(ColorPt cp)
Set the highlight color for signature fields
This option only has an effect if field highlighting is turned on using
`setHighlightFields(true)`.
| ||||||||||
void |
setSnappingMode(int mode_flags)
Set the point snapping mode for the SnapToNearestInDoc method.
| ||||||||||
void |
setThinLineAdjustment(boolean pixel_grid_fit, boolean stroke_adjust)
Set thin line adjustment parameters.
| ||||||||||
void |
setToolMode(int mode)
Set the new tool mode (such as pan, text select, etc).
| ||||||||||
void |
setUrlExtraction(boolean enabled)
Enables or disables URL extraction.
| ||||||||||
void | setV(int v) | ||||||||||
void |
setVScrollPos(double pos)
Sets the vertical scroll position in the scrollable space..
| ||||||||||
void |
setVerticalAlign(int align)
Set the vertical alignment used for rendering pages within the view.
| ||||||||||
static void |
setViewerCache(SDFDoc document, int max_cache_size, boolean on_disk)
Sets the cache parameters of the page cache on disk (which caches content
streams and mipmapped images) for this specific document.
| ||||||||||
boolean |
setZoom(double zoom)
Set the zoom factor to a new value.
| ||||||||||
boolean |
setZoom(int x, int y, double zoom)
Set the zoom factor to a new value using the given pixel coordinate (x,y)
as a zoom center.
| ||||||||||
void |
setupThumbnails(boolean use_embedded, boolean generate_at_runtime, boolean use_disk_cache, int thumb_max_side_length, long max_abs_cache_size, double max_perc_cache_size)
Specify the different thumbnail settings for the viewer.
| ||||||||||
void |
showAnnotation(Annot annot)
Enable rendering of a particular annotation.
| ||||||||||
boolean |
showRect(int page_num, Rect rect)
Changes the viewing area to fit a rectangle on specified page number.
| ||||||||||
boolean |
smartZoom(int x, int y)
Set the zoom factor to a new value using the given pixel coordinate (x,y)
as a zoom center.
| ||||||||||
Point2D.Double |
snapToNearestInDoc(double x, double y)
Returns the point within the document geometry that is closest to another
arbtrary point in screen space
| ||||||||||
void |
takeSnapshot(String meta_info)
Get the state of the conversion process.
| ||||||||||
String |
undo()
Return to the previous state.
| ||||||||||
void |
update(Annot a, int num_page)
Redraws the area covered with a given annotation.
| ||||||||||
void |
update()
Redraws the contents of the buffer.
| ||||||||||
void |
update(Rect rec)
Redraws the given area in the buffer.
| ||||||||||
void |
update(Field field)
Redraws all instances (Widgets) of the field.
| ||||||||||
void | update(Graphics g) | ||||||||||
void |
updatePageLayout()
Updates the page layout within the view.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
javax.swing.JComponent
| |||||||||||
From class
java.awt.Container
| |||||||||||
From class
java.awt.Component
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
com.pdftron.pdf.__Delete
| |||||||||||
From interface
java.awt.MenuContainer
| |||||||||||
From interface
java.awt.image.ImageObserver
| |||||||||||
From interface
java.lang.AutoCloseable
| |||||||||||
From interface
javax.swing.Scrollable
|
PDFViewCtrl class supports a number of 'built-in' tool modes. ToolMode enumerates tool modes supported by PDFViewCtrl.
This constant is deprecated.
use FACING
instead.
only two pages fit in the current view (similar to booklet view).
This constant is deprecated.
use FACING_CONTINUOUS
instead.
pages are displayed sequentially with two pages per row.
This constant is deprecated.
use FACING_CONTINUOUS_COVER
instead.
display the pages in two columns, with odd-numbered pages on the right.
This constant is deprecated.
use FACING_COVER
instead.
display the pages two at a time, with odd-numbered pages on the right.
The Constant e_pan.
This constant is deprecated.
use SINGLE_CONTINUOUS
instead.
pages are displayed sequentially (one underneath another).
This constant is deprecated.
use SINGLE_PAGE
instead.
only one page at a time fits in the current view.
The Constant e_text_rect_select.
The Constant e_text_struct_select.
PDFViewCtrl constructor. Create PDFViewCtrl without associating it to any document.
Instantiates a new PDFViewCtrl.
preferred_width | the preferred PDFViewCtrl width |
---|
this method returns the first page number that has text selection on it. Useful when there are selections on multiple pages at the same time.
this method returns the last page number that has text selection on it. Useful when there are selections on multiple pages at the same time.
Checks for selection on page.
page | the page |
---|
Cancels rendering in progress. If PDFViewCtrl is not busy rendering the page, the function has no side effects.
Cancels rendering in progress and returns immediately, potentially before rendering has actually stopped.
Remove any text selection.
Frees the native memory of the object. This can be explicity called to control the deallocation of native memory and avoid situations where the garbage collector does not free the object in a timely manner.
PDFNetException |
---|
Convert a point in canvas space to a point in a page space.
x | x coordinate of the canvas point |
---|---|
y | y coordinate of the canvas point |
page_num | the page number for the page used as the origin of the destination coordinate system. Pages are indexed starting from 1. |
Convert a point expressed in canvas space to a point in the current page space.
x | x coordinate of the canvas point |
---|---|
y | y coordinate of the canvas point |
Convert a point expressed in canvas space to a point in screen space.
x | x coordinate of the canvas point |
---|---|
y | y coordinate of the canvas point |
Convert a point in page space to a point in canvas space.
x | x coordinate of the point on the specified page |
---|---|
y | y coordinate of the point on the specified page |
page_num | input page number |
Convert a point in a page space to a point in canvas space.
x | x coordinate of point on current page |
---|---|
y | y coordinate of point on current page |
Convert a point from a page space to screen space.
x | x coordinate of the point on the current page |
---|---|
y | y coordinate of the point on the current page |
Convert a point from a page space to a point in screen space.
x | x coordinate of the point on the specified page |
---|---|
y | y coordinate of the point on the specified page |
page_num | input page number |
Convert a point expressed in screen space to a point in canvas space.
x | x coordinate of the screen point |
---|---|
y | y coordinate of the screen point |
Convert a point expressed in screen space to a point in a page space.
x | x coordinate of the screen point |
---|---|
y | y coordinate of the screen point |
page_num | the input page number |
Convert a point expressed in screen space to the current page space. page.
x | x coordinate of the screen point |
---|---|
y | y coordinate of the screen point |
Frees the native memory of the object. This can be explicity called to control the deallocation of native memory and avoid situations where the garbage collector does not free the object in a timely manner.
Acquires a write lock on the currently open document, optionally canceling all threads accessing the document.
Locks the currently open document to prevent competing write threads (using Lock()) from accessing the document at the same time. Other reader threads however, will be allowed to access the document. Threads attempting to obtain write access to the document will wait in suspended state until the thread that owns the lock calls doc.UnlockRead(). Note: To avoid deadlocks obtaining a write lock while holding a read lock is not permitted and will throw an exception. If this situation is encountered please either unlock the read lock before the write lock is obtained or acquire a write lock (rather than read lock) in the first place.
Try acquiring a write lock on the currently open document, waiting no longer than specified number of milliseconds.
Try acquiring a read lock on the current document, waiting no longer than specified number of milliseconds.
Releases the write lock from the currently open document.
Releases the read lock from the currently open document.
Selects text by searching for a given string of text asynchronously, and calling a user callback upon completion
search_str | - |
---|---|
match_case | - |
match_whole_word | - |
search_up | - |
reg_exp | - use regular expressions |
Gets the annotation at the (x, y) position expressed in screen coordinates.
Note: For details about client space, please refer to
convScreenPtToCanvasPt(double, double)
.
x | x coordinate of the screen point |
---|---|
y | y coordinate of the screen point |
Gets the annotation at the (x, y) position expressed in screen coordinates.
x | x coordinate of the screen point |
---|---|
y | y coordinate of the screen point |
distanceThreshold | Maximum distance from the point (x, y) to the annotation for the annot to be considered a hit. |
minimumLineWeight | For very thin lines, it is almost impossible to hit the actual line. This specifies a minimum line thickness (in screen coordinates) for the purpose of calculating whether a point is inside the annotation or not. |
Gets the list of annotations at line (x1, y1, x2, y2) expressed in screen coordinates *
x1 | x coordinate of the screen point at one of the end points of the line |
---|---|
y1 | y coordinate of the screen point at one of the end points of the line |
x2 | x coordinate of the screen point at another end point of the line |
y2 | y coordinate of the screen point at another end point of the line |
Gets the list of annotations on a given page.
page_num | The page number, where 1 is the first page. |
---|
Get the width of the rendering buffer in pixels.
Note: this method is typically used only in PDFNet for C++
Get the stride of the rendering buffer in pixels.
Note: this method is typically used only in PDFNet for C++
Get the width of the rendering buffer in pixels.
Note: this method is typically used only in PDFNet for C++
Returns the height of the scrollable space.
Returns the width of the scrollable space.
Get the current page.
Get the device transform matrix
page_num | the page number for the page used as the origin of the destination coordinate system. |
---|
Get the device transformation matrix
Note: to obtain a transformation matrix that maps screen coordinates to
page coordinates, you can invert the device matrix. For example:
Common::Matrix2D scr2page(pdfview.GetDeviceTransform());
scr2page.Inverse();
Get the document.
Get the external annot manager belonging to this PDFViewCtrl
PDFNetException |
---|
Get the external annot manager belonging to this PDFViewCtrl
mode | one of the 3 e_AnnotMgr* modes |
---|
PDFNetException |
---|
Gets the link info at a given point, specified in client space.
Note: To get valid links, setUrlExtraction(boolean)
must be set
to true before setting the document.
x | the x position in client space |
---|---|
y | the y position in client space |
PDFViewCtrl.LinkInfo
object with the link information or null if
no link is found in the queried location.
Returns any meta-data associated with the next sate in the undo chain.
PDFNetException |
---|
Returns any meta-data associated with the previous sate in the undo chain.
PDFNetException |
---|
Get the oCG context.
PDFNetException |
---|
Get the page count.
Get the page number from screen pt.
x | x coordinate of the screen point |
---|---|
y | y coordinate of the screen point |
Get the page presentation mode.
Get the page view mode.
Gets annotation bounding box in screen points
annot | target annotation |
---|---|
page_num | the page where the annotation is on |
Get the selection.
page | the page |
---|
Get the tool mode.
Get the current zoom factor.
Set the current page to the first page in the document.
Set the current page to the last page in the document.
Set the current page to the next page in the document.
Set the current page to the previous page in the document.
Checks for selection.
Disable rendering of a particular annotation. This does not change the annotation itself, just how it is displayed in this viewer instance.
The InvalidateRect function adds a rectangle to the buffer/window update region. The update region represents the portion of the buffer/window's client area that must be redrawn
Scrolls the contents of the rendering buffer 'pix_dx' horizontally and 'pix_dy' vertically.
pix_dx | horizontal scroll offset, in pixels |
---|---|
pix_dy | vertical scroll offset, in pixels |
Go to the next state in the undo/redo chain. Returns any meta-data associated with that state.
PDFNetException |
---|
Helper function that will refresh annotation and/or field appearances if needed, and then render modified page areas, all based on the contents of the view_change parameter.
view_change | contains all the updated fields and rectangles. |
---|
PDFNetException |
---|
Determine whether this DocumentConversion has progress reporting capability.
PDFNetException |
---|
Rotates all pages in the document 90 degrees clockwise.
Rotates all pages in the document 90 degrees counter-clockwise.
Selects all text on the page.
Selects texts by Highlights.
hlts | - the Highlights to be selected. |
---|
Selects all words that intersect the given selection rectangle.
x1 | the x1 |
---|---|
y1 | the y1 |
x2 | the x2 |
y2 | the y2 |
Selects texts by PDFViewCtrl.Selection.
sel | - the PDFViewCtrl.Selection to be selected. |
---|
Selects text taking into account page logical structure. This type of selection is similar to HTML like selection in web-browsers.
x1 | the x1 |
---|---|
y1 | the y1 |
x2 | the x2 |
y2 | the y2 |
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).
Note: Anti-aliasing is enabled by default.
enable_aa | the new anti aliasing |
---|
Set the default background color used to paint the area surrounding each page.
c | the new background |
---|
Set the default background color used to paint the area surrounding each page.
r | the r |
---|---|
g | the g |
b | the b |
Enables or disables caching.
Note: by default caching is enabled
enabled | if true caching is enabled, if false caching is disabled. |
---|
This method is deprecated.
use #setColorPostprocessMode()ColorPostprocessMode instead.
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.
mode | is the specific transform to be applied |
---|
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.
mode | is the specific transform to be applied |
---|
Set the current page to the given page.
page_num | input page number |
---|
Set the callback function (i.e. a delegate) that is called whenever current page number changes. This can be used to update the current page number within GUI applications etc.
curr_pagenum_proc | Callback function (or a delegate in .NET). |
---|---|
data | Custom data to be passed as a second parameter to 'curr_pagenum_proc'. |
Set the default 'paper' color used to draw background of each page.
r | the r |
---|---|
g | the g |
b | the b |
Set the default 'paper' color used to draw background of each page.
c | the new default page color |
---|
Set device DPI, and scale factor. This affects the rendering of certain content, such as annotations with the no_zoom flag.
dpi | Scale relative to the internal DPI of 96 (default 1.0). |
---|---|
scale_factor | Some DPI sensitive content, sush as annotations, can be scaled up, to make the content larger, which can make user interaction easier (default 1.0). |
Associates this PDFViewCtrl with a given PDF document.
Note: Acquires a write lock on the document
doc | A document to be displayed in the view. |
---|
Enable or disable annotation and forms rendering. By default, all annotations and form fields are rendered.
render_annots | True to draw annotations, false otherwise. |
---|
Set the error report process
error_proc | error process |
---|---|
data | custom data |
Set the highlight color for fields This option only has an effect if field highlighting is turned on using `setHighlightFields(true)`. Note that signature fields have their own highlight color, independent of this one (see `setSignatureHighlightColor`).
cp | the new color, in rgba form. |
---|
Set the callback function (i.e. a delegate) that is called when FindTextAsync is completed.
proc | Callback function (or a delegate in .NET). |
---|---|
data | Custom data to be passed as a parameter to 'findtext_proc'. |
Set the gamma factor used for anti-aliased rendering.
Note: Gamma correction is used only in the built-in rasterizer.
exp | 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). |
---|
Sets the horizontal scroll position in the scrollable space..
pos | the new horizontal scroll position. The position should be a number in the range between 0 and GetCanvasWidth(). |
---|
Enable or disable highlighting form fields. Default is disabled.
highlight_fields | true to highlight, false otherwise. |
---|
Set the horizontal alignment used for rendering pages within the view.
align | an integer specifying the horizontal alignment. Depending of whether align is positive, negative, or zero - pages will be right, left or center aligned: align < 0 -> pages are left aligned. align == 0 -> pages are centered. align > 0 -> pages are right aligned. |
---|
Set the image smoothing.
smoothing_enabled | If true, image smoothing is enabled, otherwise it is disabled. |
---|
Enable or disable image smoothing. The rasterizer allows a trade-off between rendering quality and rendering speed. This function can be used to indicate the preference between rendering speed and quality.
* Note: image smoothing option has effect only if the source image has higher resolution that the output resolution of the image on the rasterized page. PDFNet automatically controls at what resolution/zoom factor, 'image smoothing' needs to take effect.
* Note: image smoothing is enabled.
Set the Optional Content Group (OCG) context that should be used when viewing the document. This function can be used to change the current OCG context. Optional content (such as PDF layers) will be selectively rendered based on the states of optional content groups in the given context.
Note: Unlike PDFDraw.SetOCGContext() this method copies the given context. As a result, in order to modify the state of OCG groups in the curent context use GetOCGContext() to obtain the currently selected content and then modify states.
ctx | Optional Content Group (OCG) context, or NULL if the rasterizer should render all content on the page. |
---|
PDFNetException |
---|
Enable or disable support for overprint. 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). By default overprint is enabled.
op | 0: always disabled; 1: always enabled; 2: enabled for PDF/X files only. The default is 2. |
---|
PDFNetException |
---|
Enables or disables drawing of a thin border around each page.
border_visible | - if true, the border will be visible. |
---|
Set the current page presentation mode.
mode | the new page presentation mode. |
---|
This method is deprecated.
use setPagePresentationMode(PagePresentationMode)
instead.
Set the current page presentation mode.
mode | the new page presentation mode. |
---|
Set the vertical and horizontal padding and column spacing between adjacent pages in the view.
horiz_col_space | the horiz_col_space |
---|---|
vert_col_space | the vert_col_space |
horiz_pad | the horiz_pad |
vert_pad | the vert_pad |
Enables or disables the transparency grid (check board pattern) to reflect page transparency.
trans_grid_visible | - if true, the grid is turned on. |
---|
Set the page viewing mode.
Note: The default PageView mode is FIT_WIDTH
.
mode | the new page viewing mode. |
---|
This method is deprecated.
use setPageViewMode(PageViewMode)
instead.
Set the page viewing mode.
Note: The default PageView mode is e_fit_width.
mode | the new page viewing mode. |
---|
Enable or disable path hinting. Path hinting is used to slightly adjust paths in order to avoid or alleviate artifacts of hair line cracks between certain graphical elements.
Note: Path hinting is enabled by default.
enable_ph | whether to enable or disable path hinting |
---|
Set the preferred size.
width | the width |
---|---|
height | the height |
Enables or disables progressive rendering in PDFViewCtrl.
Note: Progressive rendering is useful when a PDF page contain lots of elements (e.g. many vector paths, text, or many little images). When progressive rendering is enabled PDFNet will use painter algorithm to draw the page. This way user may be able to see partially rendered page. If a page contains only a single large image, there would be no visible benefit from progressive rendering.
is_progressive | if true, progressive rendering will be enabled, otherwise progressive rendering will be disabled. |
---|
Set 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.
builtin_rasterizer | the new rasterizer |
---|
Sets the RequestRenderInWorkerThread Callback
render_worker_proc | RequestRenderInWorkerThread Callback |
---|---|
data | custom data |
Set the border color for required fields This option only has an effect if field highlighting is turned on using `setHighlightFields(true)`.
cp | the new color, in rgba form. |
---|
Set the highlight color for signature fields This option only has an effect if field highlighting is turned on using `setHighlightFields(true)`. Note that non-signature fields have their own highlight color, independent of this one (see `setFieldHighlightColor`)
cp | the new color, in rgba form. |
---|
Set the point snapping mode for the SnapToNearestInDoc method. By default SnapToNearestInDoc will snap to line endpoints, midpoints, and intersections.
Set thin line adjustment parameters.
pixel_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 only works if path hinting is enabled. |
---|---|
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. |
Set the new tool mode (such as pan, text select, etc).
mode | new tool mode. |
---|
Enables or disables URL extraction.
enabled | if true, URL extraction is enabled; if false URL
extraction is disabled.
* Note: by default URL extraction is disabled * Note: If set to enabled when the document is already opened, it may not find links on pages that were already rendered. It is suggested to set this flag before opening the document. |
---|
Sets the vertical scroll position in the scrollable space..
Note: In this context the canvas is defined in the screen coordinate system and is a rectangle that surrounds all pages in the current page layout.
pos | the new vertical scroll position. The position should be a number in the range between 0 and GetCanvasheight(). |
---|
Set the vertical alignment used for rendering pages within the view.
align | an integer specifying the horizontal alignment. Depending of whether align is positive, negative, or zero - pages will be right, left or center aligned: align < 0 -> pages are left aligned. align == 0 -> pages are centered. align > 0 -> pages are right aligned. |
---|
Sets the cache parameters of the page cache on disk (which caches content streams and mipmapped images) for this specific document. These parameters will override the default cache parameters. Note that if this function is called after the document has been rasterized, it has no effect.
max_cache_size | The maximum size, in bytes, of the entire document's page cache. Set to zero to disable the viewer cache. |
---|---|
on_disk | If set to 'true', cache will be stored on the local filesystem. If set to 'false', cache will be stored in heap memory. |
PDFNetException |
---|
Set the zoom factor to a new value. The function zooms to a point at the center of the rendering buffer.
zoom | new scaling component used to display the page content. |
---|
Set the zoom factor to a new value using the given pixel coordinate (x,y) as a zoom center. The zoom point (x,y) is represented in the screen coordinate system, which starts in the upper-left corner of the client window.
x | the horizontal coordinate to zoom in. |
---|---|
y | the vertical coordinate to zoom in. |
zoom | - new scaling component used to display the page content. |
Specify the different thumbnail settings for the viewer.
use_embedded | Enables or disables using thumbnails embedded in the PDF document as a preview of the rendered page. (Currently ignored - future versions may take advantage of embedded thumbnails) |
---|---|
generate_at_runtime | Enables or disables generating thumbnails at runtime. |
use_disk_cache | Enables or disables caching thumbnails in a temporary disk file. |
thumb_max_side_length | The maximum size, in pixels, of a dimension of generated thumbnails. |
max_abs_cache_size | The absolute maximum size on disk, in bytes, for the temporary thumbnail cache. |
max_perc_cache_size | The maximum percentage of free disk space, in the range 0 - 1.0, that the cache can take up. |
Enable rendering of a particular annotation. Only has an effect if HideAnnotation() has prviously been called on the same annot.
Changes the viewing area to fit a rectangle on specified page number. Rectangle must be specified in page coordinates. This will adjust current page and zoom appropriately.
page_num | input page number |
---|---|
rect | the rectangle to fit in |
Set the zoom factor to a new value using the given pixel coordinate (x,y) as a zoom center. The zoom point (x,y) is represented in the screen coordinate system, which starts in the upper-left corner of the client window.
x | the horizontal coordinate to zoom in. |
---|---|
y | the vertical coordinate to zoom in. |
Returns the point within the document geometry that is closest to another arbtrary point in screen space
x | x coordinate of the screen point |
---|---|
y | y coordinate of the screen point |
Get the state of the conversion process. Pair this with ConvertNextPage().
meta_info | -- info to be attached to this particlar undo state. |
---|
PDFNetException |
---|
Return to the previous state. Returns any meta-data associated with that state.
PDFNetException |
---|
Redraws the area covered with a given annotation.
a | the a |
---|---|
num_page | the num_page |
Redraws the contents of the buffer.
Redraws all instances (Widgets) of the field.
field | the field for which to update all occurances |
---|
Updates the page layout within the view.