Loading...
Searching...
No Matches
pdftron::PDF::PDFView Class Reference

`#include <PDFView.h>`

## Public Types
enum | PagePresentationMode { e_single_page = 1 , e_single_continuous , e_facing , e_facing_continuous , e_facing_cover , e_facing_continuous_cover }
enum | TextSelectionMode { e_structural , e_rectangular , e_structural_algorithm_2 }
enum | PageViewMode { e_fit_page = 0 , e_fit_width , e_fit_height , e_zoom , PVM_SIZE }
typedef void(* | CurrentPageProc) (int current_page, int num_pages, void *data)
typedef void(* | JavaScriptEventProc) (const char *event_type, const char *json, void *data)
typedef void(* | CurrentZoomProc) (double curr_zoom_proc, void *data)
typedef void(* | RenderBeginEventProc) (void *data)
typedef void(* | RenderFinishEventProc) (void *data, bool canceled)
typedef void(* | ThumbAsyncHandler) (int page_num, bool was_thumb_found, const char *thumb_buf, int thumb_width, int thumb_height, void *custom_data)
typedef void(* | RequestRenderInWorkerThreadProc) (void *custom_data)
typedef void(* | FindTextHandler) (bool success, PDF::Selection selection, void *custom_data)

## Public Member Functions
| PDFView ()
| ~PDFView ()
void | SetDoc (PDFDoc &doc)
void | OpenUniversalDoc (DocumentConversion &conversion)
void | CloseDoc ()
PDFDoc * | GetDoc ()
void | DocLock (bool cancel_threads)
void | DocUnlock ()
bool | DocTryLock (int milliseconds=0)
void | DocLockRead ()
void | DocUnlockRead ()
bool | DocTryLockRead (int milliseconds=0)
void | SetPagePresentationMode (PagePresentationMode mode)
PagePresentationMode | GetPagePresentationMode () const
void | SetColorPostProcessMode (PDFRasterizer::ColorPostProcessMode mode)
void | SetColorPostProcessMapFile (Filters::Filter image_file_contents)
ColorPt | GetPostProcessedColor (const ColorPt &color) const
void | SetColorPostProcessColors (unsigned int white_color, unsigned int black_color)
PDFRasterizer::ColorPostProcessMode | GetColorPostProcessMode () const
int | GetCurrentPage () const
int | GetPageCount () const
bool | GotoFirstPage ()
bool | GotoLastPage ()
bool | GotoNextPage ()
bool | GotoPreviousPage ()
bool | SetCurrentPage (int page_num)
bool | ShowRect (int page_num, const Rect &rect)
std::vector< int > | GetVisiblePages () const
double | GetZoom () const
bool | SetZoom (double zoom)
bool | SetZoom (int x, int y, double zoom)
bool | SmartZoom (int x, int y)
void | RotateClockwise ()
void | RotateCounterClockwise ()
Page::Rotate | GetRotation () const
int | GetPageNumberFromScreenPt (double x, double y) const
Point | ConvScreenPtToCanvasPt (const Point &pt) const
void | ConvScreenPtToCanvasPt (double &x, double &y) const
Point | ConvCanvasPtToScreenPt (const Point &pt) const
void | ConvCanvasPtToScreenPt (double &x, double &y) const
Point | ConvCanvasPtToPagePt (const Point &pt, int page_num=-1) const
void | ConvCanvasPtToPagePt (double &x, double &y, int page_num=-1) const
Point | ConvPagePtToCanvasPt (const Point &pt, int page_num=-1) const
void | ConvPagePtToCanvasPt (double &x, double &y, int page_num=-1) const
Point | ConvScreenPtToPagePt (const Point &pt, int page_num=-1) const
void | ConvScreenPtToPagePt (double &x, double &y, int page_num=-1) const
Point | ConvPagePtToScreenPt (const Point &pt, int page_num=-1) const
void | ConvPagePtToScreenPt (double &x, double &y, int page_num=-1) const
Point | SnapToNearestInDoc (const Point &screen_pt)
void | SetSnappingMode (UInt32 mode_flags)
Common::Matrix2D | GetDeviceTransform (int page_num=-1) const
void | SetErrorReportProc (PDFRasterizer::ErrorReportProc error_proc, void *data)
void | SetCurrentPageProc (CurrentPageProc curr_pagenum_proc, void *data)
void | SetJavaScriptEventCallBack (JavaScriptEventProc js_proc, void *data)
void | SetCurrentZoomProc (CurrentZoomProc curr_zoom_proc, void *data)
void | ExecuteAction (Action &action)
void | ExecuteAction (ActionParameter &action_param)
double | GetCanvasWidth () const
double | GetCanvasHeight () const
double | GetHScrollPos () const
double | GetVScrollPos () const
void | OnScroll (int pix_dx, int pix_dy)
void | SetHScrollPos (double pos)
void | SetVScrollPos (double pos)
void | OnSize (int width, int height)
bool | IsFinishedRendering (bool visible_region_only) const
void | CancelRendering ()
void | Update (bool all=false)
void | Update (const Rect &update)
void | Update (const Annot &annot, int page_num)
void | Update (const Field &field)
void | UpdatePageLayout ()
const char * | GetBuffer () const
void | UpdateBuffer ()
int | GetBufferWidth () const
int | GetBufferHeight () const
int | GetBufferStride () const
void | HideAnnotation (Annot annot)
void | ShowAnnotation (Annot annot)
void | SetDrawAnnotations (bool render_annots)
void | SetUrlExtraction (bool enabled)
LinkInfo | GetLinkAt (int x, int y)
void | SetFieldHighlightColor (const ColorPt &new_field_highlight_color)
void | SetHighlightFields (bool highlight_fields)
void | SetRequiredFieldBorderColor (const ColorPt &new_border_color)
void | SetSignatureHighlightColor (const ColorPt &new_signature_highlight_color)
void | SetAntiAliasing (bool enable_aa)
void | SetPathHinting (bool enable_hinting)
void | SetThinLineAdjustment (bool pixel_grid_fit, bool stroke_adjust)
void | SetImageSmoothing (bool smoothing_enabled=true)
void | SetCaching (bool enabled)
void | SetRasterizerType (PDFRasterizer::Type type)
void | SetGamma (double exp)
void | SetOverprint (PDFRasterizer::OverprintPreviewMode op)
void | SetOCGContext (const OCG::Context &ctx)
OCG::Context | GetOCGContext ()
void | UpdateOCGContext ()
void | SetRenderBeginProc (RenderBeginEventProc proc, void *data)
void | SetRenderFinishProc (RenderFinishEventProc proc, void *data)
void | SetTextSelectionMode (TextSelectionMode tm)
TextSelectionMode | GetTextSelectionMode () const
void | SetRightToLeftLanguage (bool flag)
bool | GetRightToLeftLanguage () const
bool | Select (double x1, double y1, double x2, double y2)
bool | SelectWithSnapping (double x1, double y1, double x2, double y2, bool snap_to_start, bool snap_to_end)
bool | SelectWithSmartSnapping (double x1, double y1, double x2, double y2)
bool | Select (double x1, double y1, int page1, double x2, double y2, int page2)
bool | SelectWithSnapping (double x1, double y1, int page1, double x2, double y2, int page2, bool snap_to_start, bool snap_to_end)
bool | SelectWithSmartSnapping (double x1, double y1, int page1, double x2, double y2, int page2)
bool | Select (const Highlights &highlights)
bool | Select (const Selection &select)
void | CancelFindText ()
void | SelectAll ()
bool | HasSelection () const
void | ClearSelection ()
Selection | GetSelection (int pagenum=-1) const
int | GetSelectionBeginPage () const
int | GetSelectionEndPage () const
bool | HasSelectionOnPage (int ipage) const
void | PrepareWords (int page_num)
bool | WereWordsPrepared (int page_num) const
bool | IsThereTextInRect (double x1, double y1, double x2, double y2) const
void | PrepareAnnotsForMouse (int page_num, double distance_threshold, double minimum_line_weight)
bool | WereAnnotsForMousePrepared (int page_num) const
Annot::Type | GetAnnotTypeUnder (double x, double y)
void | SetPageBorderVisibility (bool border_visible)
void | SetPageTransparencyGrid (bool trans_grid_visible)
void | SetDefaultPageColor (UInt8 r, UInt8 g, UInt8 b)
void | SetBackgroundColor (UInt8 r, UInt8 g, UInt8 b, UInt8 a=255)
void | SetHorizontalAlign (int align)
void | SetVerticalAlign (int align)
void | SetPageSpacing (int horiz_col_space, int vert_col_space, int horiz_pad, int vert_pad)
void | Destroy ()
void | SetDevicePixelDensity (double dpi, double scale_factor)
Rect | GetScreenRectForAnnot (Annot annot, int page_num=-1)
Annot | GetAnnotationAt (int x, int y, double distanceThreshold, double minimumLineWeight)
void | SetPageViewMode (PageViewMode mode)
PageViewMode | GetPageViewMode () const
void | RefreshAndUpdate (const ViewChangeCollection &view_change)
void | SetPageRefViewMode (PageViewMode mode)
PageViewMode | GetPageRefViewMode () const
void | SetupThumbnails (bool use_embedded, bool generate_at_runtime, bool use_disk_cache, int thumb_max_side_length, size_t max_abs_cache_size, double max_perc_cache_size)
void | ClearThumbCache ()
void | GetThumbAsync (int page_num, ThumbAsyncHandler proc, void *custom_data)
size_t | GetThumbInCacheSize (int page_num)
bool | GetThumbInCache (int page_num, UChar *buf, UInt32 &out_width, UInt32 &out_height)
void | CancelAllThumbRequests ()
void | SetRequestRenderInWorkerThreadProc (RequestRenderInWorkerThreadProc proc, void *custom_data)
void | SetFindTextHandler (PDFView::FindTextHandler proc, void *custom_data)
void | FindTextAsync (const UString &search_str, bool match_case, bool match_whole_word, bool search_up, bool reg_exp)
std::vector< Annot > | GetAnnotationsOnPage (int page_num)
std::vector< Annot > | GetAnnotationListAt (int x1, int y1, int x2, int y2)
void | EnableUndoRedo ()
UString | Undo ()
UString | Redo ()
bool | HasChangesSinceSnapshot ()
void | TakeSnapshot (const UString &meta_info)
UString | GetNextUndoInfo ()
UString | GetNextRedoInfo ()
bool | CanUndo ()
bool | CanRedo ()
void | RevertChangesSinceSnapshot ()
void | RevertAllChanges ()
ExternalAnnotManager | GetExternalAnnotManager (const UString &author, ExternalAnnotManager::Mode mode=ExternalAnnotManager::e_admin_undo_own)

## Static Public Member Functions
static void | SetViewerCache (SDF::SDFDoc &document, size_t max_cache_size, bool on_disk)

## Detailed Description

PDFView is a utility class that can be used for interactive rendering of PDF documents.

In .NET environment PDFView 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).

PDFView 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:

- Page Space refers to the space in which a PDF page is defined. It is determined by a page itself and the origin is at the lower-left corner of the page. Note that Page Space is independent of how a page is viewed in PDFView and each page has its own Page space.
- Canvas Space refers to the tightest axis-aligned bounding box of all the pages given the current page presentation mode in PDFView. For example, if the page presentation mode is e_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.
- Screen Space (or Client Space) is the space occupied by PDFView and its origin is at the upper-left corner. Note that the virtual size of this space can extend beyond the visible region.
- Scrollable Space is the virtual space within which PDFView can scroll. It is determined by the Canvas Space and the current zoom factor. Roughly speaking, the dimensions of the Scrollable Space is the dimensions of the Canvas Space timed by the zoom. Therefore, a large zoom factor will result in a larger Scrollable region given the same Canvas region. For this reason, Scrollable Space might also be referred to as Zoomed Canvas Space. Note that since PDFView adds gaps between pages in Canvas Space and these gaps are not scaled when rendered, the scrollable range is not exactly what the zoom factor times the Canvas range. For functions such as SetHScrollPos(), SetVScrollPos(), GetCanvasHeight(), and GetCanvasWidth(), it is the Scrollable Space that is involved.

Note
  PDFView is available on all platforms supported by PDFNet.

Definition at line 72 of file PDFView.h.

## Member Typedef Documentation

## ◆ CurrentPageProc

typedef void(* pdftron::PDF::PDFView::CurrentPageProc) (int current_page, int num_pages, void *data)

A prototype for a callback function (or a delegate in .NET terminology) that will be called whenever current page number changes.

Parameters

  current_page | the current page.
  num_pages | total number of pages in the document.
  data | Custom data to be passed as a second parameter to 'curr_pagenum_proc'.

Definition at line 503 of file PDFView.h.

## ◆ CurrentZoomProc

typedef void(* pdftron::PDF::PDFView::CurrentZoomProc) (double curr_zoom_proc, void *data)

A prototype for a callback function (or a delegate in .NET terminology) that will be called whenever current zoom (magnification) number changes.

Parameters

  current_zoom | the current zoom.
  data | Custom data to be passed as a second parameter to 'curr_zoom_proc'.

Definition at line 550 of file PDFView.h.

## ◆ FindTextHandler

typedef void(* pdftron::PDF::PDFView::FindTextHandler) (bool success, PDF::Selection selection, void *custom_data)

FindTextHandler A type of callback function (or a delegate in .NET terminology) that is called once FindTextAsync is completed.

Definition at line 1477 of file PDFView.h.

## ◆ JavaScriptEventProc

typedef void(* pdftron::PDF::PDFView::JavaScriptEventProc) (const char *event_type, const char *json, void *data)

A prototype for a callback function (or a delegate in .NET terminology) for JavaScript action. Can be used to handle alert event which pops up a window with alert message.

Parameters

  event_type | such as 'alert'
  json | contains event data
  data | user defined data

Definition at line 528 of file PDFView.h.

## ◆ RenderBeginEventProc

typedef void(* pdftron::PDF::PDFView::RenderBeginEventProc) (void *data)

Declaration for the callback function that will be called just before PDFView starts rendering.

Parameters

  data | Custom data to be passed as a parameter to 'proc'.

Definition at line 958 of file PDFView.h.

## ◆ RenderFinishEventProc

typedef void(* pdftron::PDF::PDFView::RenderFinishEventProc) (void *data, bool canceled)

Declaration for the callback function that will be called after PDFView is done with rendering.

Parameters

  data | Custom data to be passed as a parameter to 'proc'.
  canceled | - this parameter is false if PDFView successfully completed the rendering, or is true if the rendering was canceled.

Note
  this callback is available only in the C++ SDK and not available in pre-packaged PDF viewing controls (.NET/Java/ActiveX).

Definition at line 971 of file PDFView.h.

## ◆ RequestRenderInWorkerThreadProc

typedef void(* pdftron::PDF::PDFView::RequestRenderInWorkerThreadProc) (void *custom_data)

A type of callback function that is called from a secondary thread to issue a rendering request on the UI thread.

Definition at line 1456 of file PDFView.h.

## ◆ ThumbAsyncHandler

typedef void(* pdftron::PDF::PDFView::ThumbAsyncHandler) (int page_num, bool was_thumb_found, const char *thumb_buf, int thumb_width, int thumb_height, void *custom_data)

Declaration for the callback function that will be called after GetThumbAsync retrieves a thumbnail from the on-disk thumbnail cache.

Parameters

  page_num | The page number of the thumbnail.
  was_thumb_found | A boolean value which is true if the thumbnail could be retrieved from the persistent cache, and false otherwise.
  thumb_buf | A pointer to the thumbnail image. This buffer's size, in bytes, is equal to thumb_width * thumb_height * 4.
  thumb_width | The width, in pixels, of the thumbnail image.
  thumb_height | The height, in pixels, of the thumbnail image.
  custom_data | Custom data passed into GetThumbAsync.

Definition at line 1408 of file PDFView.h.

## Member Enumeration Documentation

## ◆ PagePresentationMode

enum pdftron::PDF::PDFView::PagePresentationMode

PagePresentationMode lists common modes of presenting PDF pages.

Enumerator
e_single_page |
e_single_continuous |
e_facing |
e_facing_continuous |
e_facing_cover |
e_facing_continuous_cover |

Definition at line 156 of file PDFView.h.

## ◆ PageViewMode

enum pdftron::PDF::PDFView::PageViewMode

PageViewMode lists common modes of viewing PDF pages. PDFView currently supports the following viewing modes:

- e_fit_page - page zoom is automatically adjusted so that entire page fits into available space.
- e_fit_width - page zoom is automatically adjusted so that page width fits into available space.
- e_fit_height - page zoom is automatically adjusted so that page height fits into available space.
- e_zoom - page is zoomed. The zoom ratio is specified using SetZoom() function.
- PVM_SIZE - the size of the enum, should always stay as the last element

Enumerator
e_fit_page |
e_fit_width |
e_fit_height |
e_zoom |
PVM_SIZE |

Definition at line 1327 of file PDFView.h.

## ◆ TextSelectionMode

enum pdftron::PDF::PDFView::TextSelectionMode

TextSelectionMode lists different text selection modes that can be used to highlight text. PDFView currently supports the following text selection modes:

- e_structural - Selects text based on the logical structure of the page. This type of selection is similar to HTML like selection in web-browsers.
- e_rectangular - Selects all words that intersect the given selection rectangle.
- e_structural_algorithm_2 - Similar to e_structural but use different algorithm when the start point is not inside a block (not being too smart).

Enumerator
e_structural |
e_rectangular |
e_structural_algorithm_2 |

Definition at line 1017 of file PDFView.h.

## Constructor & Destructor Documentation

## ◆ PDFView()

pdftron::PDF::PDFView::PDFView | ( |  | ) |

PDFView constructor and destructor. Create PDFView without associating it to any document.

## ◆ ~PDFView()

pdftron::PDF::PDFView::~PDFView | ( |  | ) |

## Member Function Documentation

## ◆ CancelAllThumbRequests()

void pdftron::PDF::PDFView::CancelAllThumbRequests | ( |  | ) |

## ◆ CancelFindText()

void pdftron::PDF::PDFView::CancelFindText | ( |  | ) |

Cancel the text search thread if FindText() is started in a different thread. Note that if the text search thread is currently being suspended by the render thread, it will only be canceled after it is awaken by the render thread.

## ◆ CancelRendering()

void pdftron::PDF::PDFView::CancelRendering | ( |  | ) |

Cancels rendering in progress. If PDFView is not busy rendering the page, the function has no side effects.

## ◆ CanRedo()

bool pdftron::PDF::PDFView::CanRedo | ( |  | ) |

Returns whether there is a redo state available in the undo/redo chain.

Returns
  true if redo is available, false otherwise.

## ◆ CanUndo()

bool pdftron::PDF::PDFView::CanUndo | ( |  | ) |

Returns whether there is an undo state available in the undo/redo chain.

Returns
  true if undo is available, false otherwise.

## ◆ ClearSelection()

void pdftron::PDF::PDFView::ClearSelection | ( |  | ) |

Remove any text selection.

## ◆ ClearThumbCache()

void pdftron::PDF::PDFView::ClearThumbCache | ( |  | ) |

Remove all thumbnails from the persistent disk cache.

## ◆ CloseDoc()

void pdftron::PDF::PDFView::CloseDoc | ( |  | ) |

Close the associated PDF document.

## ◆ ConvCanvasPtToPagePt() [1/2]

Point pdftron::PDF::PDFView::ConvCanvasPtToPagePt | ( | const Point & | pt,
|  | int | page_num = -1 ) const

Converts a point expressed in canvas space to a point in a page space.

Parameters

  page_num | the page number for the page used as the origin of the destination coordinate system. Negative values are used to represent the current page. Pages are indexed starting from one.

## ◆ ConvCanvasPtToPagePt() [2/2]

void pdftron::PDF::PDFView::ConvCanvasPtToPagePt | ( | double & | x,
|  | double & | y,
|  | int | page_num = -1 ) const

## ◆ ConvCanvasPtToScreenPt() [1/2]

Point pdftron::PDF::PDFView::ConvCanvasPtToScreenPt | ( | const Point & | pt | ) | const

Converts a point expressed in canvas space to a point in screen space.

## ◆ ConvCanvasPtToScreenPt() [2/2]

void pdftron::PDF::PDFView::ConvCanvasPtToScreenPt | ( | double & | x,
|  | double & | y ) const

## ◆ ConvPagePtToCanvasPt() [1/2]

Point pdftron::PDF::PDFView::ConvPagePtToCanvasPt | ( | const Point & | pt,
|  | int | page_num = -1 ) const

Converts a point from a page space to point in canvas space.

Parameters

  page_num | the page number for the page used as the origin of the destination coordinate system. Negative values are used to represent the current page. Pages are indexed starting from one.

## ◆ ConvPagePtToCanvasPt() [2/2]

void pdftron::PDF::PDFView::ConvPagePtToCanvasPt | ( | double & | x,
|  | double & | y,
|  | int | page_num = -1 ) const

## ◆ ConvPagePtToScreenPt() [1/2]

Point pdftron::PDF::PDFView::ConvPagePtToScreenPt | ( | const Point & | pt,
|  | int | page_num = -1 ) const

Converts a point in a page space to a point in the screen space. If PDFView is in a non-continous page view mode, and the page is not visible, the result is undefined.

Parameters

  page_num | the page number for the page used as the origin of the destination coordinate system. Negative values are used to represent the current page. Pages are indexed starting from one.

## ◆ ConvPagePtToScreenPt() [2/2]

void pdftron::PDF::PDFView::ConvPagePtToScreenPt | ( | double & | x,
|  | double & | y,
|  | int | page_num = -1 ) const

## ◆ ConvScreenPtToCanvasPt() [1/2]

Point pdftron::PDF::PDFView::ConvScreenPtToCanvasPt | ( | const Point & | pt | ) | const

Converts a point expressed in screen space to a point in canvas space.

## ◆ ConvScreenPtToCanvasPt() [2/2]

void pdftron::PDF::PDFView::ConvScreenPtToCanvasPt | ( | double & | x,
|  | double & | y ) const

## ◆ ConvScreenPtToPagePt() [1/2]

Point pdftron::PDF::PDFView::ConvScreenPtToPagePt | ( | const Point & | pt,
|  | int | page_num = -1 ) const

Converts a point expressed in screen space to a point in a page space.

Parameters

  page_num | the page number for the page used as the origin of the destination coordinate system. Negative values are used to represent the current page. Pages are indexed starting from one.

## ◆ ConvScreenPtToPagePt() [2/2]

void pdftron::PDF::PDFView::ConvScreenPtToPagePt | ( | double & | x,
|  | double & | y,
|  | int | page_num = -1 ) const

## ◆ Destroy()

void pdftron::PDF::PDFView::Destroy | ( |  | ) |

Frees the native memory of the object.

## ◆ DocLock()

void pdftron::PDF::PDFView::DocLock | ( | bool | cancel_threads | ) |

Acquires a write lock on the currently open document, optionally canceling all threads accessing the document.

## ◆ DocLockRead()

void pdftron::PDF::PDFView::DocLockRead | ( |  | ) |

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.

## ◆ DocTryLock()

bool pdftron::PDF::PDFView::DocTryLock | ( | int | milliseconds = 0 | ) |

Try acquiring a write lock on the currently open document, waiting no longer than specified number of milliseconds.

Returns
  true if the document is locked for multi-threaded access, false otherwise.

## ◆ DocTryLockRead()

bool pdftron::PDF::PDFView::DocTryLockRead | ( | int | milliseconds = 0 | ) |

Try acquiring a read lock on the current document, waiting no longer than specified number of milliseconds.

Returns
  true if the document is locked for multi-threaded access, false otherwise.

## ◆ DocUnlock()

void pdftron::PDF::PDFView::DocUnlock | ( |  | ) |

Releases the write lock from the currently open document.

## ◆ DocUnlockRead()

void pdftron::PDF::PDFView::DocUnlockRead | ( |  | ) |

Releases the read lock from the currently open document.

## ◆ EnableUndoRedo()

void pdftron::PDF::PDFView::EnableUndoRedo | ( |  | ) |

Enable Undo/Redo in this PDFView.

## ◆ ExecuteAction() [1/2]

void pdftron::PDF::PDFView::ExecuteAction | ( | Action & | action | ) |

Requests action object to be executed by PDFViewCtrl. Action must belong to the document currently displayed in PDFViewCtrl.

Parameters

  action | object that is to be executed.

## ◆ ExecuteAction() [2/2]

void pdftron::PDF::PDFView::ExecuteAction | ( | ActionParameter & | action_param | ) |

## ◆ FindTextAsync()

void pdftron::PDF::PDFView::FindTextAsync | ( | const UString & | search_str,
|  | bool | match_case,
|  | bool | match_whole_word,
|  | bool | search_up,
|  | bool | reg_exp )

Searches for the provided search string in the documents in a secondary thread, and calls FindTextHandler with the resulting selection.

Parameters

  search_str | The string to search for in the document
  match_case | Set to true for case-sensitive search
  match_whole_word | Set to true to match whole words only
  search_up | Set to true to search up through the document
  reg_exp | Set to true to interpret search_str as a regular expression

## ◆ GetAnnotationAt()

Annot pdftron::PDF::PDFView::GetAnnotationAt | ( | int | x,
|  | int | y,
|  | double | distanceThreshold,
|  | double | minimumLineWeight )

Gets the annotation at the (x, y) position expressed in screen coordinates

Parameters

  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.

Returns
  the annotation at (x, y). If there is no annotation at (x, y), the returned annotation's IsValid method will return false.

## ◆ GetAnnotationListAt()

std::vector< Annot > pdftron::PDF::PDFView::GetAnnotationListAt | ( | int | x1,
|  | int | y1,
|  | int | x2,
|  | int | y2 )

Returns a vector of annotations under the line (x1, y1, x2, y2) expressed in screen coordinates. Does not include form field annotations.

Parameters

  x1 | The x-coordinate of the first point of the line.
  y1 | The y-coordinate of the first point of the line.
  x2 | The x-coordinate of the second point of the line.
  y2 | The y-coordinate of the second point of the line.

Returns
  A vector of annotations under the line (x1, y1, x2, y2) expressed in screen coordinates.

## ◆ GetAnnotationsOnPage()

std::vector< Annot > pdftron::PDF::PDFView::GetAnnotationsOnPage | ( | int | page_num | ) |

Returns a vector of all of the annotations on the given page.

Parameters

  page_num | The page number for which to retrieve annotations.

Returns
  A vector of all of the annotations on the given page.

## ◆ GetAnnotTypeUnder()

Annot::Type pdftron::PDF::PDFView::GetAnnotTypeUnder | ( | double | x,
|  | double | y )

Returns
  annotation type at the given point

Parameters

  x | - x coordinate of the input point
  y | - y coordinate in the input point

## ◆ GetBuffer()

const char * pdftron::PDF::PDFView::GetBuffer | ( |  | ) | const

Returns the pointer to the internal memory buffer containing the rasterized image of the given page. The buffer size is at least 'GetBufferHeight*GetBufferStride' bytes. The pixel data is stored in 8 bit per component, BGRA format.

## ◆ GetBufferHeight()

int pdftron::PDF::PDFView::GetBufferHeight | ( |  | ) | const

Returns the width of the rendering buffer in pixels.

Note
  this method is typically used only in PDFNet for C++

## ◆ GetBufferStride()

int pdftron::PDF::PDFView::GetBufferStride | ( |  | ) | const

Returns the stride of the rendering buffer in pixels.

Note
  this method is typically used only in PDFNet for C++

## ◆ GetBufferWidth()

int pdftron::PDF::PDFView::GetBufferWidth | ( |  | ) | const

Returns the width of the rendering buffer in pixels.

Note
  this method is typically used only in PDFNet for C++

## ◆ GetCanvasHeight()

double pdftron::PDF::PDFView::GetCanvasHeight | ( |  | ) | const

Returns the height of the scrollable space.

## ◆ GetCanvasWidth()

double pdftron::PDF::PDFView::GetCanvasWidth | ( |  | ) | const

Returns the width of the scrollable space.

## ◆ GetColorPostProcessMode()

PDFRasterizer::ColorPostProcessMode pdftron::PDF::PDFView::GetColorPostProcessMode | ( |  | ) | const

Returns
  the current color post processing mode.

## ◆ GetCurrentPage()

int pdftron::PDF::PDFView::GetCurrentPage | ( |  | ) | const

Returns
  the current page displayed in the view.

## ◆ GetDeviceTransform()

Common::Matrix2D pdftron::PDF::PDFView::GetDeviceTransform | ( | int | page_num = -1 | ) | const

Returns
  the device transformation matrix. The device transformation matrix maps the page coordinate system to screen (or device) coordinate system.

Parameters

  page_num | same as for PDFView.Conv???() methods.

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();
  pdftron::Common::Matrix2D
  Definition Matrix2D.h:104

## ◆ GetDoc()

PDFDoc * pdftron::PDF::PDFView::GetDoc | ( |  | ) |

Returns
  Currently associated document with this PDFView.

## ◆ GetExternalAnnotManager()

ExternalAnnotManager pdftron::PDF::PDFView::GetExternalAnnotManager | ( | const UString & | author,
|  | ExternalAnnotManager::Mode | mode = ExternalAnnotManager::e_admin_undo_own )

## ◆ GetHScrollPos()

double pdftron::PDF::PDFView::GetHScrollPos | ( |  | ) | const

Returns
  the current horizontal scroll position in the scrollable space.

## ◆ GetLinkAt()

LinkInfo pdftron::PDF::PDFView::GetLinkAt | ( | int | x,
|  | int | y )

Gets the link info at a given point, specified in client space.

Parameters

  x | the x position in client space
  y | the y position in client space

Returns
  the LinkInfo object with the link information or null if no link is found in the queried location.

Note
  To get valid links, SetUrlExtraction(boolean) must be set to true before opening the document.

## ◆ GetNextRedoInfo()

UString pdftron::PDF::PDFView::GetNextRedoInfo | ( |  | ) |

Returns any meta-data associated with the next state in the redo chain.

Note
  An empty string means redo is unavailable.

Returns
  The meta-data associated with the next state in the redo chain.

## ◆ GetNextUndoInfo()

UString pdftron::PDF::PDFView::GetNextUndoInfo | ( |  | ) |

Returns any meta-data associated with the previous state in the undo chain.

Note
  An empty string or "{\"label\":\"initial\"}" means that undo is unavailable.

Returns
  The meta-data associated with the previous state in the undo chain.

## ◆ GetOCGContext()

OCG::Context pdftron::PDF::PDFView::GetOCGContext | ( |  | ) |

Returns
  the Optional Content Group (OCG) context associated with this PDFView, or NULL (i.e. context.IsValid()==false) if there is no OCG context associated with the view. If an OCG context associated with the view, optional content (such as PDF layers) will be selectively rendered based on the states of optional content groups in the given context.

## ◆ GetPageCount()

int pdftron::PDF::PDFView::GetPageCount | ( |  | ) | const

Returns
  the total number of pages in the document.

## ◆ GetPageNumberFromScreenPt()

int pdftron::PDF::PDFView::GetPageNumberFromScreenPt | ( | double | x,
|  | double | y ) const

Returns
  the number of the page located under the given screen coordinate. The positive number indicates a valid page, whereas number less than 1 means that no page was found.

## ◆ GetPagePresentationMode()

PagePresentationMode pdftron::PDF::PDFView::GetPagePresentationMode | ( |  | ) | const

Returns
  the current page presentation mode.

## ◆ GetPageRefViewMode()

PageViewMode pdftron::PDF::PDFView::GetPageRefViewMode | ( |  | ) | const

Gets the reference page view mode. See more details about reference page view mode in `setPageRefViewMode(int)`.

## ◆ GetPageViewMode()

PageViewMode pdftron::PDF::PDFView::GetPageViewMode | ( |  | ) | const

Returns
  the current page viewing mode

## ◆ GetPostProcessedColor()

ColorPt pdftron::PDF::PDFView::GetPostProcessedColor | ( | const ColorPt & | color | ) | const

Converts a color based on the view's color post processing transformation.

Parameters

  color | the color to be converted

Returns
  the post-processed color

## ◆ GetRightToLeftLanguage()

bool pdftron::PDF::PDFView::GetRightToLeftLanguage | ( |  | ) | const

Returns the current right-to-left language mode for structural selection.

Returns
  true if the current language mode is right-to-left.

## ◆ GetRotation()

Page::Rotate pdftron::PDF::PDFView::GetRotation | ( |  | ) | const

Returns
  The current rotation of this PDFView.

## ◆ GetScreenRectForAnnot()

Rect pdftron::PDF::PDFView::GetScreenRectForAnnot | ( | Annot | annot,
|  | int | page_num = -1 )

Gets the annotation bounding box in screen points

Parameters

  annot | target annotation
  page_num | the page number that the annotation is on S

Returns
  the annotation bounding box in screen points

## ◆ GetSelection()

Selection pdftron::PDF::PDFView::GetSelection | ( | int | pagenum = -1 | ) | const

Returns
  Current text selection for a given page

## ◆ GetSelectionBeginPage()

int pdftron::PDF::PDFView::GetSelectionBeginPage | ( |  | ) | const

Returns
  the first page number that has text selection on it. Useful when there are selections on multiple pages at the same time.

## ◆ GetSelectionEndPage()

int pdftron::PDF::PDFView::GetSelectionEndPage | ( |  | ) | const

Returns
  the last page number that has text selection on it. Useful when there are selections on multiple pages at the same time.

## ◆ GetTextSelectionMode()

TextSelectionMode pdftron::PDF::PDFView::GetTextSelectionMode | ( |  | ) | const

Returns
  the current selection mode used for text highlighting.

## ◆ GetThumbAsync()

void pdftron::PDF::PDFView::GetThumbAsync | ( | int | page_num,
|  | ThumbAsyncHandler | proc,
|  | void * | custom_data )

Retrieves the specified thumbnail from the persistent thumbnail cache on disk, then calling proc on the resulting thumbnail.

Parameters

  page_num | The page number of the thumbnail.
  proc | A callback function that will be called after the thumbnail is retrieved, or if that retrieval fails.
  data | Custom data to be passed as a parameter to 'proc'.

## ◆ GetThumbInCache()

bool pdftron::PDF::PDFView::GetThumbInCache | ( | int | page_num,
|  | UChar * | buf,
|  | UInt32 & | out_width,
|  | UInt32 & | out_height )

Retrieves the specified thumbnail from the persistent thumbnail cache on disk if it is available.

Parameters

  page_num | The page number of the thumbnail.
  buf | the buffer in which to store thumbnail data. This buffer should have space for GetThumbInCacheSize bytes.
  out_width | the width of the thumbnail
  out_height | the height of the thumbnail

Returns
  true if the thumbnail is found in the cache and false otherwise.

## ◆ GetThumbInCacheSize()

size_t pdftron::PDF::PDFView::GetThumbInCacheSize | ( | int | page_num | ) |

Gets the data size of a cached thumbnail.

Parameters

  page_num | The page number of the thumbnail.

Returns
  if the thumbnail is available returns the size of the thumbnail in bytes otherwise returns 0

## ◆ GetVisiblePages()

std::vector< int > pdftron::PDF::PDFView::GetVisiblePages | ( |  | ) | const

Get a vector with the pages currently visible on the screen.

Returns
  a vector of the pages currently visible on the screen.

## ◆ GetVScrollPos()

double pdftron::PDF::PDFView::GetVScrollPos | ( |  | ) | const

Returns
  the current vertical scroll position in the scrollable space.

## ◆ GetZoom()

double pdftron::PDF::PDFView::GetZoom | ( |  | ) | const

Returns the current zoom factor.

Returns
  current zoom (or scaling) component used to display the page content.

## ◆ GotoFirstPage()

bool pdftron::PDF::PDFView::GotoFirstPage | ( |  | ) |

Sets the current page to the first page in the document.

Returns
  true if successful, false otherwise.

## ◆ GotoLastPage()

bool pdftron::PDF::PDFView::GotoLastPage | ( |  | ) |

Sets the current page to the last page in the document.

Returns
  true if successful, false otherwise.

## ◆ GotoNextPage()

bool pdftron::PDF::PDFView::GotoNextPage | ( |  | ) |

Sets the current page to the next page in the document.

Returns
  true if successful, false otherwise.

## ◆ GotoPreviousPage()

bool pdftron::PDF::PDFView::GotoPreviousPage | ( |  | ) |

Sets the current page to the previous page in the document.

Returns
  true if successful, false otherwise.

## ◆ HasChangesSinceSnapshot()

bool pdftron::PDF::PDFView::HasChangesSinceSnapshot | ( |  | ) |

Returns whether the document has been modified since the last undo/redo snapshot was taken.

Returns
  true if the document was modified since the last snapshot, false otherwise.

## ◆ HasSelection()

bool pdftron::PDF::PDFView::HasSelection | ( |  | ) | const

Returns
  return true if there is selection, false otherwise.

## ◆ HasSelectionOnPage()

bool pdftron::PDF::PDFView::HasSelectionOnPage | ( | int | ipage | ) | const

Returns
  returns true if given page number has any text selection on it. Useful when there are selections on multiple pages at the same time.

## ◆ HideAnnotation()

void pdftron::PDF::PDFView::HideAnnotation | ( | Annot | annot | ) |

Disable rendering of a particular annotation. This does not change the annotation itself, just how it is displayed in this viewer instance.

Parameters

  annot | The annotation object to cease drawing for.

## ◆ IsFinishedRendering()

bool pdftron::PDF::PDFView::IsFinishedRendering | ( | bool | visible_region_only | ) | const

Parameters

  visible_region_only | - Specifies if the method refers only to currently visible content.

Returns
  true is the rendering thread finished rendering the view, false if the rendering is still in progress.

## ◆ IsThereTextInRect()

bool pdftron::PDF::PDFView::IsThereTextInRect | ( | double | x1,
|  | double | y1,
|  | double | x2,
|  | double | y2 ) const

Returns
  true if there is a text in the given rectangle, false otherwise and point (x2, y2) is the end selection point. The points are defined in screen space.

## ◆ OnScroll()

void pdftron::PDF::PDFView::OnScroll | ( | int | pix_dx,
|  | int | pix_dy )

Scrolls the contents of the rendering buffer 'pix_dx' horizontally and 'pix_dy' vertically.

Parameters

  pix_dx | horizontal scroll offset, in pixels
  pix_dy | vertical scroll offset, in pixels

## ◆ OnSize()

void pdftron::PDF::PDFView::OnSize | ( | int | width,
|  | int | height )

Resize rendering buffer to new dimensions.

Parameters

  width | - The width of the target image in pixels.
  height | - The height of the target image in pixels (the number of rows).

Note
  this method is typically used only in PDFNet for C++

## ◆ OpenUniversalDoc()

void pdftron::PDF::PDFView::OpenUniversalDoc | ( | DocumentConversion & | conversion | ) |

Associates this PDFView with a given document conversion. The conversion will be performed page-by-page, asynchronously. The pdview object will be updated to display the conversion result

Parameters

  doc | - A document to be displayed in the view.

## ◆ PrepareAnnotsForMouse()

void pdftron::PDF::PDFView::PrepareAnnotsForMouse | ( | int | page_num,
|  | double | distance_threshold,
|  | double | minimum_line_weight )

Requests for preparing annotations of the given page. Note: Annotations are going to be prepared asynchronously

Parameters

  page_num | - page number
  distance_threshold | - Maximum distance from the point (x, y) to the annotation for the annot to be considered a hit.
  minimum_line_weight | - 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

## ◆ PrepareWords()

void pdftron::PDF::PDFView::PrepareWords | ( | int | page_num | ) |

Requests for preparing words of the given page. Note: Words are going to be prepared asynchronously

Parameters

  page_num | - page number

## ◆ Redo()

UString pdftron::PDF::PDFView::Redo | ( |  | ) |

Go to the next state in the undo/redo chain.

Returns
  Meta-data associated with the current state in the undo/redo chain after redoing one state.

## ◆ RefreshAndUpdate()

void pdftron::PDF::PDFView::RefreshAndUpdate | ( | const 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.

Parameters

  view_change | contains all the updated fields and rectangles.

## ◆ RevertAllChanges()

void pdftron::PDF::PDFView::RevertAllChanges | ( |  | ) |

Returns the document to the initial state in the undo/redo chain.

## ◆ RevertChangesSinceSnapshot()

void pdftron::PDF::PDFView::RevertChangesSinceSnapshot | ( |  | ) |

Restores the document to the state of the last undo/redo snapshot, if it has been modified since.

See also
  HasChangesSinceSnapshot()

## ◆ RotateClockwise()

void pdftron::PDF::PDFView::RotateClockwise | ( |  | ) |

Rotates all pages in the document 90 degrees clockwise.

## ◆ RotateCounterClockwise()

void pdftron::PDF::PDFView::RotateCounterClockwise | ( |  | ) |

Rotates all pages in the document 90 degrees counter-clockwise.

## ◆ Select() [1/4]

bool pdftron::PDF::PDFView::Select | ( | const Highlights & | highlights | ) |

Selects texts identified by Highlights.

Returns
  true if some texts were selected, false otherwise.

Parameters

  highlights | - an instance of Highlights class.

## ◆ Select() [2/4]

bool pdftron::PDF::PDFView::Select | ( | const Selection & | select | ) |

Selects a region according to a Selection object

Returns
  true if some texts were selected, false otherwise.

Parameters

  select | - an instance of the Selection class

## ◆ Select() [3/4]

bool pdftron::PDF::PDFView::Select | ( | double | x1,
|  | double | y1,
|  | double | x2,
|  | double | y2 )

Selects text within the given region using the current text selection mode.

Returns
  true if some text was selected, false otherwise.

Parameters

  x1,y1,x2,y2 | - two points (screen coordinates, origin located at the upper-left corner of this view) defining the opposite corners of a selection rectangle.

## ◆ Select() [4/4]

bool pdftron::PDF::PDFView::Select | ( | double | x1,
|  | double | y1,
|  | int | page1,
|  | double | x2,
|  | double | y2,
|  | int | page2 )

Selects texts using structural mode.

Returns
  true if some texts were selected, false otherwise.

Parameters

  (x1,y1),page1 | - the first selection point (in page coordinates space) on page page1
  (x2,y2),page2 | - the second selection point (in page coordinates space) on page page2

## ◆ SelectAll()

void pdftron::PDF::PDFView::SelectAll | ( |  | ) |

Selects all text on the page.

## ◆ SelectWithSmartSnapping() [1/2]

bool pdftron::PDF::PDFView::SelectWithSmartSnapping | ( | double | x1,
|  | double | y1,
|  | double | x2,
|  | double | y2 )

Selects text within the given region using the current text selection mode with smart snap-to-start and snap-to-end modes.

Returns
  true if some text was selected, false otherwise.

Parameters

  x1,y1,x2,y2 | - two points (screen coordinates, origin located at the upper-left corner of this view) defining the opposite corners of a selection rectangle.

## ◆ SelectWithSmartSnapping() [2/2]

bool pdftron::PDF::PDFView::SelectWithSmartSnapping | ( | double | x1,
|  | double | y1,
|  | int | page1,
|  | double | x2,
|  | double | y2,
|  | int | page2 )

Selects texts using structural mode with smart snap-to-start and snap-to-end modes.

Returns
  true if some texts were selected, false otherwise.

Parameters

  (x1,y1),page1 | - the first selection point (in page coordinates space) on page page1
  (x2,y2),page2 | - the second selection point (in page coordinates space) on page page2

## ◆ SelectWithSnapping() [1/2]

bool pdftron::PDF::PDFView::SelectWithSnapping | ( | double | x1,
|  | double | y1,
|  | double | x2,
|  | double | y2,
|  | bool | snap_to_start,
|  | bool | snap_to_end )

Selects text within the given region using the current text selection mode with defined snap-to-start and snap-to-end modes.

Returns
  true if some text was selected, false otherwise.

Parameters

  x1,y1,x2,y2 | - two points (screen coordinates, origin located at the upper-left corner of this view) defining the opposite corners of a selection rectangle.
  snap_to_start,snap-to-end | if selected text should contain the whole word at start/end of selection points.

## ◆ SelectWithSnapping() [2/2]

bool pdftron::PDF::PDFView::SelectWithSnapping | ( | double | x1,
|  | double | y1,
|  | int | page1,
|  | double | x2,
|  | double | y2,
|  | int | page2,
|  | bool | snap_to_start,
|  | bool | snap_to_end )

Selects texts using structural mode with defined snap-to-start and snap-to-end modes.

Returns
  true if some texts were selected, false otherwise.

Parameters

  (x1,y1),page1 | - the first selection point (in page coordinates space) on page page1
  (x2,y2),page2 | - the second selection point (in page coordinates space) on page page2
  snap_to_start,snap-to-end | if selected text should contain the whole word at start/end of selection points

## ◆ SetAntiAliasing()

void pdftron::PDF::PDFView::SetAntiAliasing | ( | bool | 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).

@default Anti-aliasing is enabled by default.

## ◆ SetBackgroundColor()

void pdftron::PDF::PDFView::SetBackgroundColor | ( | UInt8 | r,
|  | UInt8 | g,
|  | UInt8 | b,
|  | UInt8 | a = 255 )

Sets the default background color used to paint the area surrounding each page.

Parameters

  r,g,b | - RGB color specifying the default background color.
  a | - The alpha value of the background color. Default value is 255.

## ◆ SetCaching()

void pdftron::PDF::PDFView::SetCaching | ( | bool | enabled | ) |

Enables of disables caching of images, fonts, and other resources. Disabling caching can lower memory requirements at the expense of rendering speed.

Parameters

  enabled | if true caching is enabled, if false caching is disabled. @default by default caching is enabled

## ◆ SetColorPostProcessColors()

void pdftron::PDF::PDFView::SetColorPostProcessColors | ( | unsigned int | white_color,
|  | unsigned int | black_color )

Sets 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. This mode will map the brightness of the original rasterized bitmap to a gradient between whiteColor and blackColor

Parameters

  white_color | The white color (ARGB) of the page.
  black_color | The black color (ARGB) of the page.

## ◆ SetColorPostProcessMapFile()

void pdftron::PDF::PDFView::SetColorPostProcessMapFile | ( | Filters::Filter | image_file_contents | ) |

Sets 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.

This mode will map the brightness of the original rasterized bitmap to a gradient in image_file_contents from left to right.

Parameters

  image_file_contents | A filter with image file contents.

## ◆ SetColorPostProcessMode()

void pdftron::PDF::PDFView::SetColorPostProcessMode | ( | PDFRasterizer::ColorPostProcessMode | 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

  mode | is the specific transform to be applied

## ◆ SetCurrentPage()

bool pdftron::PDF::PDFView::SetCurrentPage | ( | int | page_num | ) |

Sets the current page to the given page.

Returns
  true if successful, false otherwise.

## ◆ SetCurrentPageProc()

void pdftron::PDF::PDFView::SetCurrentPageProc | ( | CurrentPageProc | curr_pagenum_proc,
|  | void * | data )

Sets 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.

Parameters

  curr_pagenum_proc | Callback function (or a delegate in .NET).
  data | Custom data to be passed as a second parameter to 'curr_pagenum_proc'.

## ◆ SetCurrentZoomProc()

void pdftron::PDF::PDFView::SetCurrentZoomProc | ( | CurrentZoomProc | curr_zoom_proc,
|  | void * | data )

Sets the callback function (i.e. a delegate) that is called whenever current zoom (magnification) changes. This can be used to update the current zoom number within GUI applications etc.

Parameters

  curr_zoom_proc | Callback function (or a delegate in .NET).
  data | Custom data to be passed as a second parameter to 'curr_zoom_proc'.

## ◆ SetDefaultPageColor()

void pdftron::PDF::PDFView::SetDefaultPageColor | ( | UInt8 | r,
|  | UInt8 | g,
|  | UInt8 | b )

Sets the default 'paper' color used to draw background of each page.

Parameters

  r,g,b | - RGB color specifying the default page color.

## ◆ SetDevicePixelDensity()

void pdftron::PDF::PDFView::SetDevicePixelDensity | ( | double | dpi,
|  | double | scale_factor )

Set device pixel density

## ◆ SetDoc()

void pdftron::PDF::PDFView::SetDoc | ( | PDFDoc & | doc | ) |

Associates this PDFView with a given PDF document.

Parameters

  doc | - A document to be displayed in the view.

## ◆ SetDrawAnnotations()

void pdftron::PDF::PDFView::SetDrawAnnotations | ( | bool | render_annots | ) |

Enable or disable annotation and forms rendering. By default, all annotations and form fields are rendered.

Parameters

  render_annots | True to draw annotations, false otherwise.

## ◆ SetErrorReportProc()

void pdftron::PDF::PDFView::SetErrorReportProc | ( | PDFRasterizer::ErrorReportProc | error_proc,
|  | void * | data )

Sets the error handling function to be called in case an error is encountered during page rendering.

Parameters

  error_proc | Error handling callback function (or delegate in .NET)
  data | Custom data to be passed as a second parameter to 'error_proc'.

## ◆ SetFieldHighlightColor()

void pdftron::PDF::PDFView::SetFieldHighlightColor | ( | const ColorPt & | new_field_highlight_color | ) |

Set the highlight color for required 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).

Parameters

  new_field_highlight_color | the new highlight color, in rgba form.

## ◆ SetFindTextHandler()

void pdftron::PDF::PDFView::SetFindTextHandler | ( | PDFView::FindTextHandler | proc,
|  | void * | custom_data )

Sets the FindText handling function to be called once FindTextAsync is done, whether it was interrupted, canceled, or completed.

Parameters

  proc | FindText handling callback function (or delegate in .NET)
  data | Custom data to be passed as a parameter to 'proc'.

## ◆ SetGamma()

void pdftron::PDF::PDFView::SetGamma | ( | double | exp | ) |

Sets the gamma factor used for anti-aliased rendering.

Parameters

  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).

Note
  Gamma correction is used only in the built-in rasterizer.

## ◆ SetHighlightFields()

void pdftron::PDF::PDFView::SetHighlightFields | ( | bool | highlight_fields | ) |

Enable or disable highlighting form fields. Default is disabled.

Parameters

  highlight_fields | true to highlight, false otherwise.

## ◆ SetHorizontalAlign()

void pdftron::PDF::PDFView::SetHorizontalAlign | ( | int | align | ) |

Sets the horizontal alignment used for rendering pages within the view.

Parameters

  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.

## ◆ SetHScrollPos()

void pdftron::PDF::PDFView::SetHScrollPos | ( | double | pos | ) |

Sets the horizontal scroll position in scrollable space.

Parameters

  the | new horizontal scroll position. The position should be in the range between 0 and GetCanvasWidth().

## ◆ SetImageSmoothing()

void pdftron::PDF::PDFView::SetImageSmoothing | ( | bool | smoothing_enabled = true | ) |

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.

Parameters

  smoothing_enabled | True to enable image smoothing, false otherwise. @default image smoothing is enabled.

## ◆ SetJavaScriptEventCallBack()

void pdftron::PDF::PDFView::SetJavaScriptEventCallBack | ( | JavaScriptEventProc | js_proc,
|  | void * | data )

Sets the callback function (i.e. a delegate) for JavaScript action. Can be used to handle alert event which pops up a window with alert message.

Parameters

  js_proc | Callback function (or a delegate in .NET).
  data | user defined data

## ◆ SetOCGContext()

void pdftron::PDF::PDFView::SetOCGContext | ( | const OCG::Context & | ctx | ) |

Sets 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.

Parameters

  ctx | Optional Content Group (OCG) context, or NULL if the rasterizer should render all content on the page.

Note
  Unlike PDFDraw.SetOCGContext() this method copies the given context. As a result, in order to modify the state of OCG groups in the current context use GetOCGContext() to obtain the currently selected content and then modify states.

## ◆ SetOverprint()

void pdftron::PDF::PDFView::SetOverprint | ( | PDFRasterizer::OverprintPreviewMode | 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).

@default By default overprint is only enabled for PDF/X files.

Parameters

  op | e_op_on: always enabled; e_op_off: always disabled; e_op_pdfx_on: enabled for PDF/X files only.

## ◆ SetPageBorderVisibility()

void pdftron::PDF::PDFView::SetPageBorderVisibility | ( | bool | border_visible | ) |

Enables or disables drawing of a thin border around each page.

Parameters

  border_visible | - if true, the border will be visible.

## ◆ SetPagePresentationMode()

void pdftron::PDF::PDFView::SetPagePresentationMode | ( | PagePresentationMode | mode | ) |

Sets the current page presentation mode.

Parameters

  mode | - the new page presentation mode. @default The default PagePresentationMode is e_single_continuous.

## ◆ SetPageRefViewMode()

void pdftron::PDF::PDFView::SetPageRefViewMode | ( | PageViewMode | mode | ) |

Sets the reference page view mode. In a non-continous page presentation mode, the reference page view mode is used to determine the page view mode upon a page change event. For example, if the reference page view mode is set to e_fit_width, the new page coming in will be displayed with width-fit mode.

Parameters

  mode | The reference page view mode to set. Valid values are e_fit_page, e_fit_width, and e_fit_height.

## ◆ SetPageSpacing()

void pdftron::PDF::PDFView::SetPageSpacing | ( | int | horiz_col_space,
|  | int | vert_col_space,
|  | int | horiz_pad,
|  | int | vert_pad )

Sets the vertical and horizontal padding and column spacing between adjacent pages in the view.

Parameters

  horiz_col_space | horizontal column spacing (represented in pixels) between adjacent pages in the view. Default is 10.
  vert_col_space | vertical column spacing (represented in pixels) between adjacent pages in the view. Default is 10.
  horiz_pad | horizontal padding (represented in pixels) on the left and right side of the view. Default is 10.
  vert_pad | vertical padding (represented in pixels) on the top and bottom side of the view. Default is 10.

## ◆ SetPageTransparencyGrid()

void pdftron::PDF::PDFView::SetPageTransparencyGrid | ( | bool | trans_grid_visible | ) |

Enables or disables the transparency grid (check board pattern) to reflect page transparency.

Parameters

  trans_grid_visible | - if true, the grid is turned on.

## ◆ SetPageViewMode()

void pdftron::PDF::PDFView::SetPageViewMode | ( | PageViewMode | mode | ) |

Sets the page viewing mode

Parameters

  mode | - the new page viewing mode. @default The default PageView mode is e_fit_width.

## ◆ SetPathHinting()

void pdftron::PDF::PDFView::SetPathHinting | ( | bool | enable_hinting | ) |

Enable or disable path hinting.

Parameters

  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.

## ◆ SetRasterizerType()

void pdftron::PDF::PDFView::SetRasterizerType | ( | PDFRasterizer::Type | 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

  type | Rasterizer type.

## ◆ SetRenderBeginProc()

void pdftron::PDF::PDFView::SetRenderBeginProc | ( | RenderBeginEventProc | proc,
|  | void * | data )

Set a callback function that can be used to notify the client that PDFView is about to start rendering and modifying the contents of the rendering buffer.

Parameters

  proc | A callback function that will be called just before PDFView starts rendering.
  data | Custom data to be passed as a parameter to 'proc'.

Note
  this method is available only in the C++ SDK and not available in pre-packaged PDF viewing controls (.NET/Java/ActiveX).

## ◆ SetRenderFinishProc()

void pdftron::PDF::PDFView::SetRenderFinishProc | ( | RenderFinishEventProc | proc,
|  | void * | data )

Set a callback function that can be used to notify the client that PDFView finished rendering and modifying the contents of the rendering buffer.

Parameters

  proc | A callback function that will be called after PDFView is done with rendering.
  data | Custom data to be passed as a parameter to 'proc'.

Note
  this method is available only in the C++ SDK and is not available in pre-packaged PDF viewing controls (.NET/Java/ActiveX).

## ◆ SetRequestRenderInWorkerThreadProc()

void pdftron::PDF::PDFView::SetRequestRenderInWorkerThreadProc | ( | RequestRenderInWorkerThreadProc | proc,
|  | void * | custom_data )

Sets a callback for issuing a render request on the UI thread. The callback will be called from a secondary thread. The called code is responsible for dispatching an event to the UI thread using the relevant mechanism.

Parameters

  proc | The callback.
  data | Custom data to be passed as a parameter to 'proc'.

## ◆ SetRequiredFieldBorderColor()

void pdftron::PDF::PDFView::SetRequiredFieldBorderColor | ( | const ColorPt & | new_border_color | ) |

Set the border color for required fields

This option only has an effect if field highlighting is turned on using SetHighlightFields(true).

Parameters

  new_border_color | the new border color, in rgba form.

## ◆ SetRightToLeftLanguage()

void pdftron::PDF::PDFView::SetRightToLeftLanguage | ( | bool | flag | ) |

Sets structural selection to work in right-to-left language mode.

Parameters

  flag | Set to true if the language is right to left.

## ◆ SetSignatureHighlightColor()

void pdftron::PDF::PDFView::SetSignatureHighlightColor | ( | const ColorPt & | new_signature_highlight_color | ) |

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)

Parameters

  new_signature_highlight_color | the new signature highlight color, in rgba form.

## ◆ SetSnappingMode()

void pdftron::PDF::PDFView::SetSnappingMode | ( | UInt32 | mode_flags | ) |

Set the point snapping mode for the SnapToNearestInDoc method. By default SnapToNearestInDoc will snap to line endpoints, midpoints, and intersections.

Parameters

  mode_flag | a bitwise combination of the members of GeometryCollection::SnappingMode

## ◆ SetTextSelectionMode()

void pdftron::PDF::PDFView::SetTextSelectionMode | ( | TextSelectionMode | tm | ) |

Sets the selection mode used for text highlighting.

Parameters

  tm | the text selection mode.

## ◆ SetThinLineAdjustment()

void pdftron::PDF::PDFView::SetThinLineAdjustment | ( | bool | pixel_grid_fit,
|  | bool | stroke_adjust )

Set thin line adjustment parameters.

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 it 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.

## ◆ SetupThumbnails()

void pdftron::PDF::PDFView::SetupThumbnails | ( | bool | use_embedded,
|  | bool | generate_at_runtime,
|  | bool | use_disk_cache,
|  | int | thumb_max_side_length,
|  | size_t | max_abs_cache_size,
|  | double | max_perc_cache_size )

Specify the different thumbnail settings for the viewer. It is recommended that this not be called after SetDoc in order to avoid clearing cached thumbnails. Calling this method with different parameters will also clear the persistent disk cache if it is in use.

Parameters

  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 on disk. If possible thumbnails are cached in a persistent manner.
  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.

## ◆ SetUrlExtraction()

void pdftron::PDF::PDFView::SetUrlExtraction | ( | bool | enabled | ) |

Enables or disables URL extraction.

Parameters

  enabled | if true URL extraction is enabled, if false URL extraction is disabled.

@default 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.

## ◆ SetVerticalAlign()

void pdftron::PDF::PDFView::SetVerticalAlign | ( | int | align | ) |

Sets the vertical alignment used for rendering pages within the view.

Parameters

  align | an integer specifying the vertical alignment. Depending of whether align is positive, negative, or zero - pages will be bottom, top or center aligned: align<0 -> pages are top aligned. align==0 -> pages are centered. align>0 -> pages are bottom aligned.

## ◆ SetViewerCache()

void pdftron::PDF::PDFView::SetViewerCache | ( | SDF::SDFDoc & | document,
|  | size_t | max_cache_size,
|  | bool | on_disk )
| static

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.

Parameters

  document | - The document whose settings will be modified.
  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.

@default Desktop: max_cache_size = 512 MB, on_disk = true | Mobile: max_cache_size = 100 MB, on_disk = false

## ◆ SetVScrollPos()

void pdftron::PDF::PDFView::SetVScrollPos | ( | double | pos | ) |

Sets the vertical scroll position in scrollable space.

Parameters

  the | new vertical scroll position. The position should be in the range between 0 and GetCanvasheight().

Should you want to center to a location (px, py) expressed in a page space, you can use the following code:

    //focus
    view.SetCurrentPage(page_num);
    view.ConvPagePtToScreenPt(px, py, page_num);
    view.SetZoom((int)px, (int)py, view.GetZoom());

    //center
    int width = view.GetBufferWidth();
    int height = view.GetBufferHeight();
    int dx = (int)(px - (double)width/2 + 0.5);
    int dy = (int)(py - (double)height/2 + 0.5);
    view.OnScroll(dx, dy);

## ◆ SetZoom() [1/2]

bool pdftron::PDF::PDFView::SetZoom | ( | double | zoom | ) |

Sets the zoom factor to a new value. The function zooms to a point at the center of the rendering buffer.

Parameters

  zoom | - new scaling component used to display the page content.

Returns
  true if successful, false otherwise.

## ◆ SetZoom() [2/2]

bool pdftron::PDF::PDFView::SetZoom | ( | int | x,
|  | int | y,
|  | double | zoom )

Sets the zoom factor to a new value using the given pixel coordinate (x,y) as a zoom center, which will stay fixed on the screen.

The zoom point (x,y) is represented in the screen space, which starts in the upper-left corner of the client window.

Should you want to move (x, y) to the center of the client window, you can use the OnScroll() subsequently:

    int x, y;
    double zoom;
    ...
    view.SetZoom(x, y, zoom);
    int width = view.GetBufferWidth();
    int height = view.GetBufferHeight();
    int dx = (int)(x - (double)width/2 + 0.5);
    int dy = (int)(y - (double)height/2 + 0.5);
    view.OnScroll(dx, dy);

Parameters

  x | - the horizontal coordinate to zoom in.
  y | - the vertical coordinate to zoom in.
  zoom | - new scaling component used to display the page content.

Returns
  true if successful, false otherwise.

## ◆ ShowAnnotation()

void pdftron::PDF::PDFView::ShowAnnotation | ( | Annot | annot | ) |

Enable rendering of a particular annotation. Only has an effect if HideAnnotation() has previously been called on the same annot.

Parameters

  annot | The annotation object to resume rendering.

## ◆ ShowRect()

bool pdftron::PDF::PDFView::ShowRect | ( | int | page_num,
|  | const Rect & | rect )

Changes the viewing area to fit a rectangle rect on page page_num. Rectangle must be specified in page coordinates. This will adjust current page and zoom appropriately.

Returns
  true if successful, false otherwise.

## ◆ SmartZoom()

bool pdftron::PDF::PDFView::SmartZoom | ( | int | x,
|  | int | y )

Sets the zoom factor to a new value using the given pixel coordinate (x,y) to find an intersecting paragraph. The width of the paragraph helps to determine the zoom value, center of the paragraph is used as a zoom center. Paragraph has to contain more than one line and be wider than 1/5th of a page width. When called on a paragraph wider than current zoom level the new zoom level is set to fit the entire page(zoom out).

The zoom point (x,y) is represented in the screen space, which starts in the upper-left corner of the client window.

Parameters

  x | - the horizontal coordinate to look for a text block.
  y | - the vertical coordinate to look for a text block.

Returns
  true if successful, false if no paragraph intersects the given point.

## ◆ SnapToNearestInDoc()

Point pdftron::PDF::PDFView::SnapToNearestInDoc | ( | const Point & | screen_pt | ) |

Snaps an xy coordinate pair (in screen space) to the nearest piece of document geometry.

## ◆ TakeSnapshot()

void pdftron::PDF::PDFView::TakeSnapshot | ( | const UString & | meta_info | ) |

Take a snapshot of the current document state.

Parameters

  meta_info | - The meta-data to be attached to this particular undo state.

## ◆ Undo()

UString pdftron::PDF::PDFView::Undo | ( |  | ) |

Return to the previous state in the undo/redo chain.

Returns
  Meta-data associated with the current state in the undo/redo chain after undoing one state.

## ◆ Update() [1/4]

void pdftron::PDF::PDFView::Update | ( | bool | all = false | ) |

Redraws the contents of the buffer.

## ◆ Update() [2/4]

void pdftron::PDF::PDFView::Update | ( | const Annot & | annot,
|  | int | page_num )

Redraws the area covered with a given annotation.

Parameters

  annot | The annotation to update.
  page_num | The page number on which the annotation is located.

## ◆ Update() [3/4]

void pdftron::PDF::PDFView::Update | ( | const Field & | field | ) |

Redraws all instances (Widgets) of the field.

Parameters

  field | the field for which to update all occurances

## ◆ Update() [4/4]

void pdftron::PDF::PDFView::Update | ( | const Rect & | update | ) |

Redraws the given area in the buffer.

Parameters

  update | The rectangle to update expressed in screen coordinates.

## ◆ UpdateBuffer()

void pdftron::PDF::PDFView::UpdateBuffer | ( |  | ) |

Update the internal memory buffer that can be returned by GetBuffer(). Since PDFView may not necessarily update the buffer until it finishes rendering the current viewing area, it is required to call UpdateBuffer() to force PDFView to write the current rasterized contents to the buffer. This is important for, say, calling GetBuffer() in a different thread to implement progressive rendering.

Note
  UpdateBuffer() ensures thread safety internally. In addition, PDFView calls UpdateBuffer() internally before the user-defined finishing-rendering callback function (specified by SetRenderFinishProc) is called, if applicable. this method is typically used only in PDFNet for C++.

## ◆ UpdateOCGContext()

void pdftron::PDF::PDFView::UpdateOCGContext | ( |  | ) |

Prompts the PDFViewCtrl to update its list of optional content groups. Call this method if you modify the PDFDoc in a way that adds or removes a layer. For example, after using Stamper to create a stamp.

## ◆ UpdatePageLayout()

void pdftron::PDF::PDFView::UpdatePageLayout | ( |  | ) |

Updates the page layout within the view. This function must be called
after document page sequence is modified (such as when a page is being added to or removed from a document) or after changes to page dimensions (e.g. after a page is rotated or resized).

## ◆ WereAnnotsForMousePrepared()

bool pdftron::PDF::PDFView::WereAnnotsForMousePrepared | ( | int | page_num | ) | const

Returns
  true if annotations of the given page have been prepared, false otherwise

Parameters

  page_num | - page number

## ◆ WereWordsPrepared()

bool pdftron::PDF::PDFView::WereWordsPrepared | ( | int | page_num | ) | const

Returns
  true if words of the given page has been prepared, false otherwise

Parameters

  page_num | - page number

The documentation for this class was generated from the following file:

- PDF/PDFView.h