pdftron::PDF::PDFViewCtrl Class Reference

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

#include <PDFViewCtrl.h>

List of all members.

Classes

struct  EventHandlers
 Class containing the event handlers to be called when certain GUI actions are happening. More...
struct  KeyEvent
 Struct containing the data necessary to process key event callback on the client side. More...
struct  MouseEvent
 Struct containing the data necessary to process mouse event callback on the client side. More...
struct  PaintEvent
 Struct containing the data necessary to process paint event callback on the client side. More...
class  Selection
 A class representing the current text selection. More...
struct  SizeEvent

Public Types

enum  WindowID { e_main_view, e_thumb_view, e_bookmark_view, e_layers_view }
 Enumeration used to indicate the sub-window that triggered an event. More...
enum  ControlEventType {
  e_mouse_move, e_mouse_enter, e_mouse_leave, e_mouse_left_down,
  e_mouse_left_up, e_mouse_left_dclick, e_mouse_right_down, e_mouse_right_up,
  e_mouse_right_dclick, e_mouse_middle_down, e_mouse_middle_up, e_mouse_middle_dclick,
  e_mouse_wheel, e_context_menu, e_key_down, e_key_up,
  e_key_press, e_paint
}
enum  PageViewMode { e_fit_page = 0, e_fit_width, e_fit_height, e_zoom }
 methods below are shared with the interface of PDFView class More...
enum  PagePresentationMode {
  e_single_page = 1, e_single_continuous, e_facing, e_facing_continuous,
  e_facing_cover, e_facing_continuous_cover
}
 PagePresentationMode lists common modes of presenting PDF pages. More...
enum  ToolMode {
  e_custom, e_pan, e_text_rect_select, e_text_struct_select,
  e_zoom_in, e_zoom_out, e_annot_edit, e_line_create,
  e_arrow_create, e_rect_create, e_oval_create, e_ink_create,
  e_text_annot_create, e_stamp_create, e_highlight_create, e_underline_create,
  e_strikeout_create, e_squiggly_create, e_text_box_create, e_calloutbox_create,
  e_polygon_create, e_polyline_create, e_file_attachment, e_sound_attachment,
  e_movie_attachment, e_caret_create, e_redaction_create, e_text_field_create,
  e_check_box_create, e_radio_button_create, e_list_box_create, e_combo_box_create,
  e_button_create, e_link_create, e_tool_mode_end
}
 PDFViewCtrl class supports a number of 'built-in' tool modes. More...
typedef UInt8(* MouseEventHandler )(struct MouseEvent *evt, void *custom_data)
typedef UInt8(* KeyEventHandler )(struct KeyEvent *evt, void *custom_data)
typedef UInt8(* PaintEventHandler )(struct PaintEvent *evt, void *custom_data)
typedef UInt8(* SizeEventHandler )(struct SizeEvent *evt, void *custom_data)
typedef UInt8(* ActionHandler )(TRN_Action action, void *custom_data)
 a callback function that gets executed when something triggers a PDF action in the document.
typedef void(* CurrentPageHandler )(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.
typedef void(* ErrorReportHandler )(const char *message, void *data)
typedef UInt32 PanelType

Public Member Functions

 PDFViewCtrl (void *parent_hwnd, void *hinstance)
 PDFViewCtrl constructor and destructor.
 ~PDFViewCtrl ()
bool SetDoc (PDFDoc &doc, const char *password=0)
 Associates this PDFViewCtrl with a given PDF document.
void CloseDoc ()
 Closes the document currently opened in PDFViewCtrl.
PDFDocGetDoc ()
void SetCustomEventHandlers (EventHandlers *handlers)
 Sets the handlers to be called when the certain events happen.
void SetActionHandler (ActionHandler action_callback, void *custom_data)
 Sets the handler function to be called on PDF action execution.
void ExecuteAction (Action action)
 Requests action object to be executed by PDFViewCtrl.
void SetCurrentPageHandler (CurrentPageHandler curr_pagenum_proc, void *data)
 Sets the callback function (i.e.
void SetErrorReportHandler (ErrorReportHandler error_proc, void *data)
 Sets the error handling function to be called in case an error is encountered during page rendering.
void OnSize (int x, int y, int width, int height)
 Sets new position and size for the control.
void Find ()
 Creates and displays a find dialog so the user can search through the text in the control.
void Copy ()
 Copies the current selection in this control.
void SelectAll ()
 Selects all text on the page.
void SetProgressiveRendering (bool progressive=true)
 Sets whether the control will render progressively or will just draw once the entire view has been rendered.
void ShowNavPanel (bool show)
 Enables or disables the navigation panel.
void EnableScrollbar (bool show)
 Enables or disables the scrollbar in the viewing area.
void ShowToolbar (bool show)
 Enables or disables the toolbar on top of the viewing area.
void ShowStatusBar (bool show)
 Enables or disables the status bar at the bottom of the viewing area.
void ShowNavToolbar (bool show)
 Enables or disables the toolbar controlling the navigation panel.
void ShowMenuBar (bool show)
 Enables or disables the menu bar that gives access to the PDFViewCtrl user functions.
void EnableInteractiveForms (bool on)
 Enables or disables interactive form editing.
void ShowDialogs (bool show)
 Enables or disables popup dialogs such as password entry and find dialogs as well as popup menus.
void SetEnabledPanels (UInt32 panels)
 Sets which panels will be enabled in the navigation panel.
UInt32 GetEnabledPanels () const
 Returns which panels are enabled in the navigation panel.
void SetSelectedPanel (PanelType panel)
 Sets the currently selected panel in the navigation panel.
PanelType GetSelectedPanel () const
 Returns the currently selected panel in the navigation panel.
void SetSplitPosition (int pos)
 Sets the horizontal size of the navigation panel.
int GetSplitPosition () const
 Returns the current horizontal size of the navigation panel.
void Print ()
 Displays a print dialog to receive information from the user and prints the document.
void Print (int first_page, int last_page, Page::Rotate rotation, int copies, const char *printer_name)
 Programatically prints the document without any dialogs.
void Refresh ()
 Causes this window to be repainted.
void CaptureMouse ()
 Directs all mouse input to this window.
void ReleaseMouse ()
 Releases mouse input captured with CaptureMouse().
bool HasCapture () const
 Returns true if this window has the current mouse capture.
void EnableLinkActivation (bool enable)
 Enables or disables whether links are activated when the user clicks on them.
void LoadCurrentConfiguration (const UString &path)
 Load the current configuration of PDFViewCtrl from a file.
void SaveCurrentConfiguration (const UString &path, Common::ProgressMonitor *progress=0)
 Save the current configuration of PDFViewCtrl to a file.
Annot GetDefaultAnnotation (const char *type)
 Retrieve the annotation which stores the default properties for a given type.
void SetFocus ()
 Set the key focus to PDFViewCtrl.
void DocProperties ()
 create Document Properties dialog
void DeletePages ()
 create DeletePagesDialog to prompt user for pages in the current PDF document to delete.
void InsertPages (const UString &src_name)
 create InsertPagesDialog to prompt user for page number from another PDF document to insert.
void InsertBlankPages ()
 create InsertBlankPagesDialog to prompt user for size and number of blank pages to insert.
void ReplacePages (const UString &src_name=UString())
 create ReplacePagesDialog to prompt user for page number from another PDF document to replace pages from current PDF document
void RotatePages ()
 create RotatePagesDialog to prompt user to rotate n pages at a specified rotation
void ExtractPages ()
 create ExtractPagesDialog to prompt user to extract n pages from the PDF and save it to a new file
void CropPages ()
 create CropPagesDialog where the user can specify a cropping for any of the boxes in a PDF Page.
void AddWatermark ()
 create AddWatermarkDialog where user can define a watermark and stamp it to a document
void SetPageViewMode (PageViewMode mode)
 Sets the page viewing mode.
PageViewMode GetPageViewMode () const
void SetPagePresentationMode (PagePresentationMode mode)
 Sets the current page presentation mode.
PagePresentationMode GetPagePresentationMode () const
int GetCurrentPage () const
int GetPageCount () const
bool GotoFirstPage ()
 Sets the current page to the first page in the document.
bool GotoLastPage ()
 Sets the current page to the last page in the document.
bool GotoNextPage ()
 Sets the current page to the next page in the document.
bool GotoPreviousPage ()
 Sets the current page to the previous page in the document.
bool SetCurrentPage (int page_num)
 Sets the current page to the given page.
bool ShowRect (int page_num, const Rect &rect)
 Changes the viewing area to fit a rectangle rect on page page_num.
double GetZoom () const
 Returns the current zoom factor.
bool SetZoom (double zoom)
 Sets the zoom factor to a new value.
bool 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.
void RotateClockwise ()
 Rotates all pages in the document 90 degrees clockwise.
void RotateCounterClockwise ()
 Rotates all pages in the document 90 degrees counter-clockwise.
Page::Rotate GetRotation () const
int GetPageNumberFromScreenPt (double x, double y) const
void ConvScreenPtToCanvasPt (double &x, double &y) const
 Converts a point expressed in screen coordinates to a point on canvas.
void ConvCanvasPtToScreenPt (double &x, double &y) const
 Converts a point expressed in canvas coordinates to a point on screen.
void ConvCanvasPtToPagePt (double &x, double &y, int page_num=-1) const
 Converts a point expressed in canvas coordinates to a point on a given page.
void ConvPagePtToCanvasPt (double &x, double &y, int page_num=-1) const
 Converts a point from a coordinate system of a given page to a point on canvas.
void ConvScreenPtToPagePt (double &x, double &y, int page_num=-1) const
 Converts a point expressed in screen coordinates to a point on a given page.
void ConvPagePtToScreenPt (double &x, double &y, int page_num=-1) const
 Converts a point from a coordinate system of a given page to a point on screen.
Common::Matrix2D GetDeviceTransform (int page_num=-1) const
double GetCanvasWidth () const
 Returns the current canvas width.
double GetCanvasHeight () const
 Returns the current canvas height.
double GetHScrollPos () const
double GetVScrollPos () const
void OnScroll (int pix_dx, int pix_dy)
 Scrolls the contents of the rendering buffer 'pix_dx' horizontally and 'pix_dy' vertically.
void SetHScrollPos (double pos)
 Sets the horizontal scroll position.
void SetVScrollPos (double pos)
 Sets the vertical scroll position.
bool IsFinishedRendering () const
void CancelRendering ()
 Cancels rendering in progress.
void Update ()
 Redraws the contents of the buffer.
void Update (const Rect &update)
 Redraws the given area in the buffer.
void Update (const Annot &annot, int page_num)
 Redraws the area covered with a given annotation.
void UpdatePageLayout ()
 Updates the page layout withing the view.
int GetViewWidth () const
 Returns the width of the main view in pixels.
int GetViewHeight () const
 Returns the width of the main view in pixels.
void SetDrawAnnotations (bool render_annots)
 Enable or disable annotation and forms rendering.
void SetAntiAliasing (bool enable_aa)
 Enable or disable anti-aliasing.
void SetImageSmoothing (bool smoothing_enabled=true)
 Enable or disable image smoothing.
void SetCaching (bool enabled)
 Enables of disables caching of images, fonts, and other resources.
void SetRasterizerType (PDFRasterizer::Type type)
 Sets the core graphics library used for rasterization and rendering.
void SetGamma (double exp)
 Sets the gamma factor used for anti-aliased rendering.
void SetOCGContext (const OCG::Context &ctx)
 Sets the Optional Content Group (OCG) context that should be used when viewing the document.
OCG::Context GetOCGContext ()
void SetToolMode (ToolMode mode)
 Sets the new tool mode (such as pan, text select, etc).
ToolMode GetToolMode () const
bool SelectByRect (double x1, double y1, double x2, double y2)
 Selects all words that intersect the given selection rectangle.
bool SelectByStruct (double x1, double y1, double x2, double y2)
 Selects text taking into account page logical structure.
bool SelectByHighlights (const Highlights &highlights)
 Selects texts identified by Highlights.
bool FindText (const UString &search_str, bool match_case=false, bool match_whole_word=false, bool search_up=false, bool reg_exp=false)
 Selects text by searching for a given string of text.
bool HasSelection () const
void ClearSelection ()
 Remove any text selection.
PDFViewCtrl::Selection GetSelection (int page=-1) const
int GetSelectionBeginPage () const
int GetSelectionEndPage () const
bool HasSelectionOnPage (int ipage) const
void SetPageBorderVisibility (bool border_visible)
 Enables or disables drawing of a thin border around each page.
void SetDefaultPageColor (UInt8 r, UInt8 g, UInt8 b)
 Sets the default 'paper' color used to draw background of each page.
void SetBackgroundColor (UInt8 r, UInt8 g, UInt8 b)
 Sets the default background color used to paint the area surrounding each page.
void SetHorizontalAlign (int align)
 Sets the horizontal alignment used for rendering pages within the view.
void SetVerticalAlign (int align)
 Sets the vertical alignment used for rendering pages within the view.
void 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.

Static Public Attributes

static const UInt32 e_none = 0x00
static const UInt32 e_bookmarks = 0x01
static const UInt32 e_layers = 0x02
static const UInt32 e_thumbview = 0x04
static const UInt32 e_all = 0x07


Detailed Description

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

Unlike PDFView, PDFViewCtrl is a control that implements a number of tool modes, dialog boxes like find and password, has some built-in form filling capabilities and a navigation panel for bookmarks, thumbview and layer views.


Member Typedef Documentation

typedef UInt8(* pdftron::PDF::PDFViewCtrl::MouseEventHandler)(struct MouseEvent *evt, void *custom_data)

typedef UInt8(* pdftron::PDF::PDFViewCtrl::KeyEventHandler)(struct KeyEvent *evt, void *custom_data)

typedef UInt8(* pdftron::PDF::PDFViewCtrl::PaintEventHandler)(struct PaintEvent *evt, void *custom_data)

typedef UInt8(* pdftron::PDF::PDFViewCtrl::SizeEventHandler)(struct SizeEvent *evt, void *custom_data)

typedef UInt8(* pdftron::PDF::PDFViewCtrl::ActionHandler)(TRN_Action action, void *custom_data)

a callback function that gets executed when something triggers a PDF action in the document.

The parameter action is can be converted to Action object via Action( (SDF::Obj*)action ). If this function returns true, PDFViewCtrl will not try to execute the action internally.

typedef void(* pdftron::PDF::PDFViewCtrl::CurrentPageHandler)(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'.

typedef void(* pdftron::PDF::PDFViewCtrl::ErrorReportHandler)(const char *message, void *data)


Member Enumeration Documentation

Enumeration used to indicate the sub-window that triggered an event.

Can be checked by clients when they are receiving event callbacks from PDFViewCtrl.

Enumerator:
e_main_view 
e_thumb_view 
e_bookmark_view 
e_layers_view 

Enumerator:
e_mouse_move 
e_mouse_enter 
e_mouse_leave 
e_mouse_left_down 
e_mouse_left_up 
e_mouse_left_dclick 
e_mouse_right_down 
e_mouse_right_up 
e_mouse_right_dclick 
e_mouse_middle_down 
e_mouse_middle_up 
e_mouse_middle_dclick 
e_mouse_wheel 
e_context_menu 
e_key_down 
e_key_up 
e_key_press 
e_paint 

methods below are shared with the interface of PDFView class

PageViewMode lists common modes of viewing PDF pages. PDFViewCtrl 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.
Enumerator:
e_fit_page 
e_fit_width 
e_fit_height 
e_zoom 

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 

PDFViewCtrl class supports a number of 'built-in' tool modes.

ToolMode enumerates tool modes supported by PDFViewCtrl.

Enumerator:
e_custom 
e_pan 
e_text_rect_select 
e_text_struct_select 
e_zoom_in 
e_zoom_out 
e_annot_edit 
e_line_create 
e_arrow_create 
e_rect_create 
e_oval_create 
e_ink_create 
e_text_annot_create 
e_stamp_create 
e_highlight_create 
e_underline_create 
e_strikeout_create 
e_squiggly_create 
e_text_box_create 
e_calloutbox_create 
e_polygon_create 
e_polyline_create 
e_file_attachment 
e_sound_attachment 
e_movie_attachment 
e_caret_create 
e_redaction_create 
e_text_field_create 
e_check_box_create 
e_radio_button_create 
e_list_box_create 
e_combo_box_create 
e_button_create 
e_link_create 
e_tool_mode_end 


Constructor & Destructor Documentation

pdftron::PDF::PDFViewCtrl::PDFViewCtrl ( void *  parent_hwnd,
void *  hinstance 
)

PDFViewCtrl constructor and destructor.

Create PDFViewCtrl without associating it to any document.

Parameters:
parent_hwnd the platform specific window handle
hinstance on windows the current HINSTANCE

pdftron::PDF::PDFViewCtrl::~PDFViewCtrl (  ) 


Member Function Documentation

bool pdftron::PDF::PDFViewCtrl::SetDoc ( PDFDoc doc,
const char *  password = 0 
)

Associates this PDFViewCtrl with a given PDF document.

Parameters:
doc - A document to be displayed in the view.
password - the password used to initialize the document

void pdftron::PDF::PDFViewCtrl::CloseDoc (  ) 

Closes the document currently opened in PDFViewCtrl.

PDFDoc* pdftron::PDF::PDFViewCtrl::GetDoc (  ) 

Returns:
Currently associated document with this PDFViewCtrl.

void pdftron::PDF::PDFViewCtrl::SetCustomEventHandlers ( EventHandlers handlers  ) 

Sets the handlers to be called when the certain events happen.

Parameters:
a class containing the event handlers

void pdftron::PDF::PDFViewCtrl::SetActionHandler ( ActionHandler  action_callback,
void *  custom_data 
)

Sets the handler function to be called on PDF action execution.

Parameters:
a function pointer to the callback

void pdftron::PDF::PDFViewCtrl::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.

void pdftron::PDF::PDFViewCtrl::SetCurrentPageHandler ( CurrentPageHandler  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'.

void pdftron::PDF::PDFViewCtrl::SetErrorReportHandler ( ErrorReportHandler  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'.

void pdftron::PDF::PDFViewCtrl::OnSize ( int  x,
int  y,
int  width,
int  height 
)

Sets new position and size for the control.

Parameters:
x - The x position of the control within its parent
y - The y position of the control within its parent
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++

void pdftron::PDF::PDFViewCtrl::Find (  ) 

Creates and displays a find dialog so the user can search through the text in the control.

void pdftron::PDF::PDFViewCtrl::Copy (  ) 

Copies the current selection in this control.

void pdftron::PDF::PDFViewCtrl::SelectAll (  ) 

Selects all text on the page.

void pdftron::PDF::PDFViewCtrl::SetProgressiveRendering ( bool  progressive = true  ) 

Sets whether the control will render progressively or will just draw once the entire view has been rendered.

Parameters:
progressive if true the view will be rendered progressively

void pdftron::PDF::PDFViewCtrl::ShowNavPanel ( bool  show  ) 

Enables or disables the navigation panel.

Parameters:
show if true the navigation panel will be enabled

void pdftron::PDF::PDFViewCtrl::EnableScrollbar ( bool  show  ) 

Enables or disables the scrollbar in the viewing area.

Parameters:
show if true the scrollbar will be enabled.

void pdftron::PDF::PDFViewCtrl::ShowToolbar ( bool  show  ) 

Enables or disables the toolbar on top of the viewing area.

Parameters:
show if true the toolbar will be enabled.

void pdftron::PDF::PDFViewCtrl::ShowStatusBar ( bool  show  ) 

Enables or disables the status bar at the bottom of the viewing area.

Parameters:
show if true the status bar will be enabled.

void pdftron::PDF::PDFViewCtrl::ShowNavToolbar ( bool  show  ) 

Enables or disables the toolbar controlling the navigation panel.

Parameters:
show if true the navigation toolbar will be enabled.

void pdftron::PDF::PDFViewCtrl::ShowMenuBar ( bool  show  ) 

Enables or disables the menu bar that gives access to the PDFViewCtrl user functions.

Parameters:
show if true the menu bar will be enabled.

void pdftron::PDF::PDFViewCtrl::EnableInteractiveForms ( bool  on  ) 

Enables or disables interactive form editing.

Parameters:
on if true interactive forms will be enabled

void pdftron::PDF::PDFViewCtrl::ShowDialogs ( bool  show  ) 

Enables or disables popup dialogs such as password entry and find dialogs as well as popup menus.

Parameters:
show if true dialogs will be enabled

void pdftron::PDF::PDFViewCtrl::SetEnabledPanels ( UInt32  panels  ) 

Sets which panels will be enabled in the navigation panel.

Parameters:
panels - A bit field composed of an OR of PDFViewCtrl::PanelType values.

UInt32 pdftron::PDF::PDFViewCtrl::GetEnabledPanels (  )  const

Returns which panels are enabled in the navigation panel.

Returns:
A bit field composed of an OR of PDFViewCtrl::PanelType values. which describes which panels are currently enabled in the navigation panel.

void pdftron::PDF::PDFViewCtrl::SetSelectedPanel ( PanelType  panel  ) 

Sets the currently selected panel in the navigation panel.

Parameters:
panel the panel to select

PanelType pdftron::PDF::PDFViewCtrl::GetSelectedPanel (  )  const

Returns the currently selected panel in the navigation panel.

Returns:
the currently selected panel type

void pdftron::PDF::PDFViewCtrl::SetSplitPosition ( int  pos  ) 

Sets the horizontal size of the navigation panel.

Parameters:
pos the new horizontal size

int pdftron::PDF::PDFViewCtrl::GetSplitPosition (  )  const

Returns the current horizontal size of the navigation panel.

Returns:
the horizontal size of the navigation panel

void pdftron::PDF::PDFViewCtrl::Print (  ) 

Displays a print dialog to receive information from the user and prints the document.

void pdftron::PDF::PDFViewCtrl::Print ( int  first_page,
int  last_page,
Page::Rotate  rotation,
int  copies,
const char *  printer_name 
)

Programatically prints the document without any dialogs.

Parameters:
first_page the first page to print
last_page the last page to print
rotation the print rotation which can allow the user to specify landscape mode
copies the number of copies to print
printer_name the name of the printer to use

void pdftron::PDF::PDFViewCtrl::Refresh (  ) 

Causes this window to be repainted.

void pdftron::PDF::PDFViewCtrl::CaptureMouse (  ) 

Directs all mouse input to this window.

Call ReleaseMouse to release the capture.

void pdftron::PDF::PDFViewCtrl::ReleaseMouse (  ) 

Releases mouse input captured with CaptureMouse().

bool pdftron::PDF::PDFViewCtrl::HasCapture (  )  const

Returns true if this window has the current mouse capture.

void pdftron::PDF::PDFViewCtrl::EnableLinkActivation ( bool  enable  ) 

Enables or disables whether links are activated when the user clicks on them.

Parameters:
enable if true enable link activation, otherwise disable it

void pdftron::PDF::PDFViewCtrl::LoadCurrentConfiguration ( const UString path  ) 

Load the current configuration of PDFViewCtrl from a file.

Parameters:
name of the file from which the settings are loaded. If it is an empty string, default location is chosen by PDFViewCtrl.

void pdftron::PDF::PDFViewCtrl::SaveCurrentConfiguration ( const UString path,
Common::ProgressMonitor *  progress = 0 
)

Save the current configuration of PDFViewCtrl to a file.

Parameters:
name of the file to which the settings are saved. If it is an empty string, default location is chosen by PDFViewCtrl.

Annot pdftron::PDF::PDFViewCtrl::GetDefaultAnnotation ( const char *  type  ) 

Retrieve the annotation which stores the default properties for a given type.

User can change these default settings by operating on this annotation.

Parameters:
the key, or identifier, of the annotation type for which the default is required. Usually this is the same as the value of 'Subtype' entry in the annotation's dictionary, allowing to easily get default annotation for given type. PDFNet is also using the following non-standard names annotation types which have more than associated creation tool: 'Arrow' to store the properties of the Line annotation drawn as an arrow; 'FreeTextCallout' to store the properties of the FreeText annotation drawn as a callout box.

void pdftron::PDF::PDFViewCtrl::SetFocus (  ) 

Set the key focus to PDFViewCtrl.

This is useful when a user needs to set the focus programatically.

void pdftron::PDF::PDFViewCtrl::DocProperties (  ) 

create Document Properties dialog

void pdftron::PDF::PDFViewCtrl::DeletePages (  ) 

create DeletePagesDialog to prompt user for pages in the current PDF document to delete.

void pdftron::PDF::PDFViewCtrl::InsertPages ( const UString src_name  ) 

create InsertPagesDialog to prompt user for page number from another PDF document to insert.

void pdftron::PDF::PDFViewCtrl::InsertBlankPages (  ) 

create InsertBlankPagesDialog to prompt user for size and number of blank pages to insert.

void pdftron::PDF::PDFViewCtrl::ReplacePages ( const UString src_name = UString()  ) 

create ReplacePagesDialog to prompt user for page number from another PDF document to replace pages from current PDF document

void pdftron::PDF::PDFViewCtrl::RotatePages (  ) 

create RotatePagesDialog to prompt user to rotate n pages at a specified rotation

void pdftron::PDF::PDFViewCtrl::ExtractPages (  ) 

create ExtractPagesDialog to prompt user to extract n pages from the PDF and save it to a new file

void pdftron::PDF::PDFViewCtrl::CropPages (  ) 

create CropPagesDialog where the user can specify a cropping for any of the boxes in a PDF Page.

The user can apply the cropping to any set of pages

void pdftron::PDF::PDFViewCtrl::AddWatermark (  ) 

create AddWatermarkDialog where user can define a watermark and stamp it to a document

void pdftron::PDF::PDFViewCtrl::SetPageViewMode ( PageViewMode  mode  ) 

Sets the page viewing mode.

Parameters:
mode - the new page viewing mode. The default PageView mode is e_fit_width.

PageViewMode pdftron::PDF::PDFViewCtrl::GetPageViewMode (  )  const

Returns:
the current page viewing mode

void pdftron::PDF::PDFViewCtrl::SetPagePresentationMode ( PagePresentationMode  mode  ) 

Sets the current page presentation mode.

Parameters:
mode - the new page presentation mode. The default PagePresentationMode is e_single_continuous.

PagePresentationMode pdftron::PDF::PDFViewCtrl::GetPagePresentationMode (  )  const

Returns:
the current page presentation mode.

int pdftron::PDF::PDFViewCtrl::GetCurrentPage (  )  const

Returns:
the current page displayed in the view.

int pdftron::PDF::PDFViewCtrl::GetPageCount (  )  const

Returns:
the total number of pages in the document.

bool pdftron::PDF::PDFViewCtrl::GotoFirstPage (  ) 

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

Returns:
true if successful, false otherwise.

bool pdftron::PDF::PDFViewCtrl::GotoLastPage (  ) 

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

Returns:
true if successful, false otherwise.

bool pdftron::PDF::PDFViewCtrl::GotoNextPage (  ) 

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

Returns:
true if successful, false otherwise.

bool pdftron::PDF::PDFViewCtrl::GotoPreviousPage (  ) 

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

Returns:
true if successful, false otherwise.

bool pdftron::PDF::PDFViewCtrl::SetCurrentPage ( int  page_num  ) 

Sets the current page to the given page.

Returns:
true if successful, false otherwise.

bool pdftron::PDF::PDFViewCtrl::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.

double pdftron::PDF::PDFViewCtrl::GetZoom (  )  const

Returns the current zoom factor.

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

bool pdftron::PDF::PDFViewCtrl::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.

bool pdftron::PDF::PDFViewCtrl::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.

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

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.

void pdftron::PDF::PDFViewCtrl::RotateClockwise (  ) 

Rotates all pages in the document 90 degrees clockwise.

void pdftron::PDF::PDFViewCtrl::RotateCounterClockwise (  ) 

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

Page::Rotate pdftron::PDF::PDFViewCtrl::GetRotation (  )  const

Returns:
The current rotation of this PDFViewCtrl.

int pdftron::PDF::PDFViewCtrl::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.

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

Converts a point expressed in screen coordinates to a point on canvas.

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

Converts a point expressed in canvas coordinates to a point on screen.

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

Converts a point expressed in canvas coordinates to a point on a given page.

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.

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

Converts a point from a coordinate system of a given page to a point on canvas.

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.

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

Converts a point expressed in screen coordinates to a point on a given page.

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.

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

Converts a point from a coordinate system of a given page to a point on screen.

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.

Common::Matrix2D pdftron::PDF::PDFViewCtrl::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 PDFViewCtrl.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(pdfviewctrl.GetDeviceTransform());
   scr2page.Inverse();

double pdftron::PDF::PDFViewCtrl::GetCanvasWidth (  )  const

Returns the current canvas width.

double pdftron::PDF::PDFViewCtrl::GetCanvasHeight (  )  const

Returns the current canvas height.

double pdftron::PDF::PDFViewCtrl::GetHScrollPos (  )  const

Returns:
the current horizontal scroll position. The returned value is expressed in the canvas coordinate system. The canvas coordinate system is defined by a bounding box that surrounds all pages in the view.

double pdftron::PDF::PDFViewCtrl::GetVScrollPos (  )  const

Returns:
the current vertical scroll position. The returned value is expressed in the canvas coordinate system. The canvas coordinate system is defined by a bounding box that surrounds all pages in the view.

void pdftron::PDF::PDFViewCtrl::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

void pdftron::PDF::PDFViewCtrl::SetHScrollPos ( double  pos  ) 

Sets the horizontal scroll position.

Parameters:
the new horizontal scroll position. The position should be a number in the range between 0 and GetCanvasWidth(). The 'pos' parameter is expressed in the canvas coordinate system. The canvas coordinate system is defined by a bounding box that surrounds all pages in the view.

void pdftron::PDF::PDFViewCtrl::SetVScrollPos ( double  pos  ) 

Sets the vertical scroll position.

Parameters:
the new vertical scroll position. The position should be a number in the range between 0 and GetCanvasheight(). The 'pos' parameter is expressed in the canvas coordinate system. The canvas coordinate system is defined by a bounding box that surrounds all pages in the view.

bool pdftron::PDF::PDFViewCtrl::IsFinishedRendering (  )  const

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

void pdftron::PDF::PDFViewCtrl::CancelRendering (  ) 

Cancels rendering in progress.

If PDFViewCtrl is not busy rendering the page, the function has no side effects.

void pdftron::PDF::PDFViewCtrl::Update (  ) 

Redraws the contents of the buffer.

void pdftron::PDF::PDFViewCtrl::Update ( const Rect update  ) 

Redraws the given area in the buffer.

Parameters:
update The rectangle to update expressed in screen coordinates.

void pdftron::PDF::PDFViewCtrl::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.

void pdftron::PDF::PDFViewCtrl::UpdatePageLayout (  ) 

Updates the page layout withing 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).

int pdftron::PDF::PDFViewCtrl::GetViewWidth (  )  const

Returns the width of the main view in pixels.

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

int pdftron::PDF::PDFViewCtrl::GetViewHeight (  )  const

Returns the width of the main view in pixels.

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

void pdftron::PDF::PDFViewCtrl::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.

void pdftron::PDF::PDFViewCtrl::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).

Anti-aliasing is enabled by default.

void pdftron::PDF::PDFViewCtrl::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. image smoothing is enabled.

void pdftron::PDF::PDFViewCtrl::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. by default caching is enabled

void pdftron::PDF::PDFViewCtrl::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.

void pdftron::PDF::PDFViewCtrl::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.

void pdftron::PDF::PDFViewCtrl::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.

OCG::Context pdftron::PDF::PDFViewCtrl::GetOCGContext (  ) 

Returns:
the Optional Content Group (OCG) context associated with this PDFViewCtrl, 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.

void pdftron::PDF::PDFViewCtrl::SetToolMode ( ToolMode  mode  ) 

Sets the new tool mode (such as pan, text select, etc).

Parameters:
mode - new tool mode.

ToolMode pdftron::PDF::PDFViewCtrl::GetToolMode (  )  const

Returns:
Current tool mode.

bool pdftron::PDF::PDFViewCtrl::SelectByRect ( double  x1,
double  y1,
double  x2,
double  y2 
)

Selects all words that intersect the given selection rectangle.

Returns:
true if some text was selected, false otherwise.
Parameters:
x1,y1,x2,y2 - two points (in screen coordinates) defining the opposite corners of a selection rectangle.

bool pdftron::PDF::PDFViewCtrl::SelectByStruct ( double  x1,
double  y1,
double  x2,
double  y2 
)

Selects text taking into account page logical structure.

This type of selection is similar to HTML like selection in web-browsers.

Returns:
true if some text was selected, false otherwise.
Parameters:
x1,y1,x2,y2 - two points (in screen coordinates) defining the opposite corners of a selection rectangle.

bool pdftron::PDF::PDFViewCtrl::SelectByHighlights ( const Highlights highlights  ) 

Selects texts identified by Highlights.

Returns:
true if some texts were selected, false otherwise.
Parameters:
highlights - an instance of Highlights class.

bool pdftron::PDF::PDFViewCtrl::FindText ( const UString search_str,
bool  match_case = false,
bool  match_whole_word = false,
bool  search_up = false,
bool  reg_exp = false 
)

Selects text by searching for a given string of text.

Returns:
true if some text was selected, false otherwise.
Parameters:
search_str -
match_case -
match_whole_word -
search_up -
reg_exp - use regular expressions

bool pdftron::PDF::PDFViewCtrl::HasSelection (  )  const

Returns:
return true if there is selection, false otherwise.

void pdftron::PDF::PDFViewCtrl::ClearSelection (  ) 

Remove any text selection.

PDFViewCtrl::Selection pdftron::PDF::PDFViewCtrl::GetSelection ( int  page = -1  )  const

Returns:
Current text selection for a given page. If there is only selection on one page, then page number does not need to be provided.

int pdftron::PDF::PDFViewCtrl::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.

int pdftron::PDF::PDFViewCtrl::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.

bool pdftron::PDF::PDFViewCtrl::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.

void pdftron::PDF::PDFViewCtrl::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.

void pdftron::PDF::PDFViewCtrl::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.

void pdftron::PDF::PDFViewCtrl::SetBackgroundColor ( UInt8  r,
UInt8  g,
UInt8  b 
)

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

Parameters:
r,g,b - RGB color specifying the default background color.

void pdftron::PDF::PDFViewCtrl::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.

void pdftron::PDF::PDFViewCtrl::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.

void pdftron::PDF::PDFViewCtrl::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.


Member Data Documentation


© 2002-2010 PDFTron Systems Inc.