pdftron::PDF::PDFView Class Reference

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

#include <PDFView.h>

List of all members.

Classes

class  Selection
 A class representing the current text selection. More...

Public Types

enum  PageViewMode { e_fit_page = 0, e_fit_width, e_fit_height, e_zoom }
 PageViewMode lists common modes of viewing PDF pages. 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...
typedef void(* 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.
typedef void(* RenderBeginEventProc )(void *data)
 Declaration for the callback function that will be called just before PDFView starts rendering.
typedef void(* RenderFinishEventProc )(void *data, bool canceled)
 Declaration for the callback function that will be called after PDFView is done with rendering.

Public Member Functions

 PDFView ()
 PDFView constructor and destructor.
 ~PDFView ()
void SetDoc (PDFDoc &doc)
 Associates this PDFView with a given PDF document.
void CloseDoc ()
 Close the associated PDF document.
PDFDocGetDoc ()
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
void SetErrorReportProc (PDFRasterizer::ErrorReportProc error_proc, void *data)
 Sets the error handling function to be called in case an error is encountered during page rendering.
void SetCurrentPageProc (CurrentPageProc curr_pagenum_proc, void *data)
 Sets the callback function (i.e.
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.
void OnSize (int width, int height)
 Resize rendering buffer to new dimensions.
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.
const char * GetBuffer () const
 Returns the pointer to the internal memory buffer containing the rasterized image of the given page.
int GetBufferWidth () const
 Returns the width of the rendering buffer in pixels.
int GetBufferHeight () const
 Returns the width of the rendering buffer in pixels.
int GetBufferStride () const
 Returns the stride of the rendering buffer 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 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.
void 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.
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.
void SelectAll ()
 Selects all text on the page.
bool HasSelection () const
void ClearSelection ()
 Remove any text selection.
PDFView::Selection GetSelection (int pagenum=-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.


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

Note:
PDFView is available on all platforms supported by PDFNet.

Member Typedef Documentation

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

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

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


Member Enumeration Documentation

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


Constructor & Destructor Documentation

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

PDFView constructor and destructor.

Create PDFView without associating it to any document.

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


Member Function Documentation

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.

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

Close the associated PDF document.

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

Returns:
Currently associated document with this PDFView.

void pdftron::PDF::PDFView::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::PDFView::GetPageViewMode (  )  const

Returns:
the current page viewing mode

void pdftron::PDF::PDFView::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::PDFView::GetPagePresentationMode (  )  const

Returns:
the current page presentation mode.

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

Returns:
the current page displayed in the view.

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

Returns:
the total number of pages in the document.

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

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

Returns:
true if successful, false otherwise.

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

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

Returns:
true if successful, false otherwise.

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

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

Returns:
true if successful, false otherwise.

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

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

Returns:
true if successful, false otherwise.

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

Sets the current page to the given page.

Returns:
true if successful, false otherwise.

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.

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

Returns the current zoom factor.

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

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.

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.

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::PDFView::RotateClockwise (  ) 

Rotates all pages in the document 90 degrees clockwise.

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

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

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

Returns:
The current rotation of this PDFView.

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.

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

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

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

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

void pdftron::PDF::PDFView::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::PDFView::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::PDFView::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::PDFView::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::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();

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

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

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

Returns the current canvas width.

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

Returns the current canvas height.

double pdftron::PDF::PDFView::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::PDFView::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::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

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

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++

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

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

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

Cancels rendering in progress.

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

void pdftron::PDF::PDFView::Update (  ) 

Redraws the contents of the buffer.

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.

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.

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

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.

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

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++

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++

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++

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.

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

Anti-aliasing is enabled by default.

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. image smoothing is enabled.

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. by default caching is enabled

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.

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.

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.

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.

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

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

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

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

Selects all text on the page.

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

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

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

Remove any text selection.

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

Returns:
Current text selection for a given page

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.

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.

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.

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.

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.

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

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.

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_space horizontal spacing (represented in pixels) between adjacent pages in the view. Default is 10.
vert_space vertical spacing (represented in pixels) between adjacent pages in the view. Default is 10.


© 2002-2010 PDFTron Systems Inc.