Class PDFViewCtrl
PDFViewCtrl is a utility class that can be used for interactive rendering of PDF documents. In .NET environment PDFViewCtrl is derived from System.Windows.Forms.Control and it can be used like a regular form (see PDFViewForm.cs in PDFView sample for C# for a concrete example). PDFViewCtrl 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.
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.
Inherited Members
Namespace: pdftron.PDF
Assembly: PDFNet.dll
Syntax
public class PDFViewCtrl : Control, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable
Constructors
PDFViewCtrl()
default PDFViewCtrl
constructor
Declaration
public PDFViewCtrl()
PDFViewCtrl(bool)
PDFViewCtrl
constructor
Declaration
public PDFViewCtrl(bool compatibility)
Parameters
Type | Name | Description |
---|---|---|
bool | compatibility | Indicates if PDFViewCtrl is compatible with v.5.7.0 and older. PDFViewCtrl shipped with PDFNet v.5.8.0 has enhanced features for better viewing experience. If compatibility is set to true, these new features are disabled. |
Fields
m_tmp_event_cache
Declaration
public void* m_tmp_event_cache
Field Value
Type | Description |
---|---|
void* |
Properties
Capture
Declaration
public bool Capture { get; set; }
Property Value
Type | Description |
---|---|
bool |
Methods
AddWatermark()
create AddWatermarkDialog where user can define a watermark and stamp it to a document
Declaration
public void AddWatermark()
Remarks
Can acquire a write lock on the document
CancelRendering()
Cancels rendering in progress. If PDFViewCtrl is not busy rendering the page, the function has no side effects.
Declaration
public void CancelRendering()
ClearSelection()
Remove any text selection.
Declaration
public void ClearSelection()
ClearThumbCache()
Remove all thumbnails from the persistent disk cache.
Declaration
public void ClearThumbCache()
CloseDoc()
Closes the document currently opened in PDFViewCtrl.
Declaration
public void CloseDoc()
Remarks
Acquires a write lock on the document
ConvCanvasPtToPagePt(ref double, ref double, int)
Converts a point expressed in canvas space to a point on a page space.
Declaration
public void ConvCanvasPtToPagePt(ref double x, ref double y, int page_num)
Parameters
Type | Name | Description |
---|---|---|
double | x | x coordinate of the canvas point |
double | y | x coordinate of the canvas point |
int | 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. |
ConvCanvasPtToScreenPt(ref double, ref double)
Converts a point expressed in canvas space to a point in sceen space.
Declaration
public void ConvCanvasPtToScreenPt(ref double x, ref double y)
Parameters
Type | Name | Description |
---|---|---|
double | x | x coordinate of canvas point. |
double | y | x coordinate of canvas point. |
ConvPagePtToCanvasPt(ref double, ref double, int)
Converts a point expressed in a page space to a point in canvas space.
Declaration
public void ConvPagePtToCanvasPt(ref double x, ref double y, int page_num)
Parameters
Type | Name | Description |
---|---|---|
double | x | x coordinate of the page point |
double | y | y coordinate of the page point |
int | 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(ref double, ref double, int)
Converts a point in a page space to a point in screen space.
Declaration
public void ConvPagePtToScreenPt(ref double x, ref double y, int page_num)
Parameters
Type | Name | Description |
---|---|---|
double | x | x coordinate of the page point |
double | y | y coordinate of the page point |
int | 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. |
ConvScreenPtToCanvasPt(ref double, ref double)
Converts a point expressed in screen space to a point in canvas space.
Declaration
public void ConvScreenPtToCanvasPt(ref double x, ref double y)
Parameters
Type | Name | Description |
---|---|---|
double | x | x coordinate of screen point. |
double | y | y coordinate of screen point. |
ConvScreenPtToPagePt(ref double, ref double, int)
Converts a point in screen space to a point in a page space.
Declaration
public void ConvScreenPtToPagePt(ref double x, ref double y, int page_num)
Parameters
Type | Name | Description |
---|---|---|
double | x | x coordinate of the screen point |
double | y | y coordinate of the screen point |
int | 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. |
Copy()
Copies the current selection in this control.
Declaration
public void Copy()
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
Declaration
public void CropPages()
Remarks
Can acquire a write lock on the document
DeletePages()
create DeletePagesDialog to prompt user for pages in the current PDF document to delete.
Declaration
public void DeletePages()
Remarks
Can acquire a write lock on the document
Dispose(bool)
Declaration
[HandleProcessCorruptedStateExceptions]
protected override void Dispose(bool A_0)
Parameters
Type | Name | Description |
---|---|---|
bool | A_0 |
Overrides
DocLock(bool)
Acquires a write lock on the currently open document, optionally canceling all threads accessing the document.
Declaration
public void DocLock(bool cancel_thread)
Parameters
Type | Name | Description |
---|---|---|
bool | cancel_thread |
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.
Declaration
public void DocLockRead()
DocProperties()
create Document Properties dialog
Declaration
public void DocProperties()
Remarks
Can acquire a write lock on the document
DocTryLock(int)
Try acquiring a write lock on the currently open document, waiting no longer than specified number of milliseconds.
Declaration
public bool DocTryLock(int milliseconds)
Parameters
Type | Name | Description |
---|---|---|
int | milliseconds |
Returns
Type | Description |
---|---|
bool | true if the document is locked for multi-threaded access, false otherwise. |
DocTryLockRead(int)
Try acquiring a read lock on the current document, waiting no longer than specified number of milliseconds.
Declaration
public bool DocTryLockRead(int milliseconds)
Parameters
Type | Name | Description |
---|---|---|
int | milliseconds |
Returns
Type | Description |
---|---|
bool | true if the document is locked for multi-threaded access, false otherwise. |
DocUnlock()
Releases the write lock on the currently open document.
Declaration
public void DocUnlock()
DocUnlockRead()
Releases the read lock on the currently open document.
Declaration
public void DocUnlockRead()
EnableInteractiveForms(bool)
Enables or disables interactive form editing.
Declaration
public void EnableInteractiveForms(bool on)
Parameters
Type | Name | Description |
---|---|---|
bool | on | if true interactive forms will be enabled |
EnableLinkActivation(bool)
Enables or disables whether links are activated when the user clicks on them.
Declaration
public void EnableLinkActivation(bool enable)
Parameters
Type | Name | Description |
---|---|---|
bool | enable | if true enable link activation, otherwise disable it |
EnableScrollbar(bool)
Enables or disables the scrollbar in the viewing area.
Declaration
public void EnableScrollbar(bool show)
Parameters
Type | Name | Description |
---|---|---|
bool | show | if true the scrollbar will be enabled. |
ExecuteAction(Action)
Requests action object to be executed by PDFViewCtrl. Action must belong to the document currently displayed in PDFViewCtrl.
Declaration
public void ExecuteAction(Action action)
Parameters
Type | Name | Description |
---|---|---|
Action | action | object that is to be executed. |
ExtractPages()
create ExtractPagesDialog to prompt user to extract n pages from the PDF and save it to a new file
Declaration
public void ExtractPages()
~PDFViewCtrl()
Declaration
protected ~PDFViewCtrl()
Find()
Creates and displays a find dialog so the user can search through the text in the control.
Declaration
public void Find()
FindTextAsync(string, bool, bool, bool, bool)
Selects text by searching for a given string of text, and invoking user delegate upon completion
Declaration
public void FindTextAsync(string str, bool match_case, bool match_whole_word, bool search_up, bool reg_exp)
Parameters
Type | Name | Description |
---|---|---|
string | str | string to search |
bool | match_case | whether to match case |
bool | match_whole_word | whether to match the whole word |
bool | search_up | whether to search up |
bool | reg_exp | whether to use regular expressions |
GetAnnotationAt(int, int)
Gets the annotation at the (x, y) position expressed in screen coordinates.
Declaration
public Annot GetAnnotationAt(int x, int y)
Parameters
Type | Name | Description |
---|---|---|
int | x | x coordinate of the screen point |
int | y | y coordinate of the screen point |
Returns
Type | Description |
---|---|
Annot | The annotation closest to the point. If no annotation was found, it returns a null pointer. |
GetCanvasHeight()
Gets the height of the scrollable space.
Declaration
public double GetCanvasHeight()
Returns
Type | Description |
---|---|
double |
GetCanvasWidth()
Gets the width of the scrollable space.
Declaration
public double GetCanvasWidth()
Returns
Type | Description |
---|---|
double |
GetChildWindowPosition()
Gets child windows position
Declaration
public Rect GetChildWindowPosition()
Returns
Type | Description |
---|---|
Rect | a rectangle describing child windows position |
GetChildWindowPosition(PDFViewCtrlWindowType)
Gets child window position of the specified type
Declaration
public Rect GetChildWindowPosition(PDFViewCtrl.PDFViewCtrlWindowType tp)
Parameters
Type | Name | Description |
---|---|---|
PDFViewCtrl.PDFViewCtrlWindowType | tp | window type |
Returns
Type | Description |
---|---|
Rect | a rectangle describing child window position |
GetColorPostProcessMode()
Declaration
public PDFRasterizer.ColorPostProcessMode GetColorPostProcessMode()
Returns
Type | Description |
---|---|
PDFRasterizer.ColorPostProcessMode | the current color post processing mode. |
GetCurrentPage()
Gets the current page displayed in the view.
Declaration
public int GetCurrentPage()
Returns
Type | Description |
---|---|
int | the current page displayed in the view. |
GetDefaultAnnotation(string)
Retrieve the annotation which stores the default properties for a given type. User can change these default settings by operating on this annotation.
Declaration
public Annot GetDefaultAnnotation(string type)
Parameters
Type | Name | Description |
---|---|---|
string | type | 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. |
Returns
Type | Description |
---|---|
Annot | the annotation which stores the default properties for a given type |
GetDeviceTransform()
Gets device transformation matrix from current page
Declaration
public Matrix GetDeviceTransform()
Returns
Type | Description |
---|---|
Matrix | the device transformation matrix. The device transformation matrix maps the page coordinate system to screen (or device) coordinate system. |
Remarks
to obtain a transformation matrix that maps screen coordinates to page coordinates, you can invert the device matrix.
GetDeviceTransform(int)
Gets device transformation matrix from current page
Declaration
public Matrix GetDeviceTransform(int page_num)
Parameters
Type | Name | Description |
---|---|---|
int | page_num | same as for PDFViewCtrl.Conv???() methods. |
Returns
Type | Description |
---|---|
Matrix | the device transformation matrix. The device transformation matrix maps the page coordinate system to screen (or device) coordinate system. |
Remarks
to obtain a transformation matrix that maps screen coordinates to page coordinates, you can invert the device matrix.
GetDoc()
Gets Currently associated document with this PDFViewCtrl.
Declaration
public PDFDoc GetDoc()
Returns
Type | Description |
---|---|
PDFDoc | Currently associated document with this PDFViewCtrl. |
GetEnabledPanels()
Returns which panels are enabled in the navigation panel.
Declaration
public int GetEnabledPanels()
Returns
Type | Description |
---|---|
int | A bit field composed of an OR of PDFViewCtrl::PanelType values. which describes which panels are currently enabled in the navigation panel. |
GetHScrollPos()
Gets the current horizontal scroll position in scrollable space.
Declaration
public double GetHScrollPos()
Returns
Type | Description |
---|---|
double | the current horizontal scroll position. |
GetLinkAt(int, int)
Gets the link info at a given point, specified in client space.
Declaration
public PDFViewCtrl.LinkInfo GetLinkAt(int x, int y)
Parameters
Type | Name | Description |
---|---|---|
int | x | the x position in client space |
int | y | the y position in client space |
Returns
Type | Description |
---|---|
PDFViewCtrl.LinkInfo | link information or null if no link is found in the queried location. |
Remarks
To get valid links, Url extraction must be set to true before setting the document.
GetOCGContext()
Gets the Optional Content Group (OCG) context associated with this PDFViewCtrl
Declaration
public Context GetOCGContext()
Returns
Type | Description |
---|---|
Context | 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. |
GetPageCount()
Gets the total number of pages in the document.
Declaration
public int GetPageCount()
Returns
Type | Description |
---|---|
int | the total number of pages in the document. |
GetPageNumberFromScreenPt(double, double)
Gets the number of the page given point in space. The positive number indicates a valid page, whereas number less than 1 means that no page was found.
Declaration
public int GetPageNumberFromScreenPt(double x, double y)
Parameters
Type | Name | Description |
---|---|---|
double | x | x coordinate under the given screen coordinate |
double | y | y coordinate under the given screen coordinate |
Returns
Type | Description |
---|---|
int | the number of the page located under the given screen coordinate |
GetPagePresentationMode()
Gets the current page presentation mode.
Declaration
public PDFViewCtrl.PagePresentationMode GetPagePresentationMode()
Returns
Type | Description |
---|---|
PDFViewCtrl.PagePresentationMode | the current page presentation mode. |
GetPageViewMode()
Gets the current page viewing mode
Declaration
public PDFViewCtrl.PageViewMode GetPageViewMode()
Returns
Type | Description |
---|---|
PDFViewCtrl.PageViewMode | the current page viewing mode |
GetRotation()
Gets the current rotation of this PDFViewCtrl.
Declaration
public Page.Rotate GetRotation()
Returns
Type | Description |
---|---|
Page.Rotate | The current rotation of this PDFViewCtrl. |
GetScreenRectForAnnot(Annot, int)
Retrieve the bounding box of the annotation in screen points
Declaration
public Rect GetScreenRectForAnnot(Annot annot, int page_num)
Parameters
Type | Name | Description |
---|---|---|
Annot | annot | the annotation which the bounding box is calculated and returned |
int | page_num | The page num to which the annotation blongs to |
Returns
Type | Description |
---|---|
Rect | A bouding box of the annotation in screen points |
GetSelectedPanel()
Gets the currently selected panel in the navigation panel.
Declaration
public PDFViewCtrl.PanelType GetSelectedPanel()
Returns
Type | Description |
---|---|
PDFViewCtrl.PanelType | the currently selected panel type |
GetSelection()
Gets Current text selection for a given page. If there is only selection on one page, then page number does not need to be provided.
Declaration
public PDFViewCtrl.Selection GetSelection()
Returns
Type | Description |
---|---|
PDFViewCtrl.Selection | Current text selection for a given page. If there is only selection on one page, then page number does not need to be provided. |
GetSelection(int)
Gets Current text selection for a given page. If there is only selection on one page, then page number does not need to be provided.
Declaration
public PDFViewCtrl.Selection GetSelection(int page)
Parameters
Type | Name | Description |
---|---|---|
int | page | page number |
Returns
Type | Description |
---|---|
PDFViewCtrl.Selection | the first page number that has text selection on it. Useful when there are selections on multiple pages at the same time. |
GetSelectionBeginPage()
Gets the first page number that has text selection on it. Useful when there are selections on multiple pages at the same time.
Declaration
public int GetSelectionBeginPage()
Returns
Type | Description |
---|---|
int | the first page number that has text selection on it |
GetSelectionEndPage()
Gets the last page number that has text selection on it. Useful when there are selections on multiple pages at the same time.
Declaration
public int GetSelectionEndPage()
Returns
Type | Description |
---|---|
int | the last page number that has text selection on it |
GetSplitPosition()
Gets the current horizontal size of the navigation panel.
Declaration
public int GetSplitPosition()
Returns
Type | Description |
---|---|
int | the horizontal size of the navigation panel |
GetThumbAsync(int, PDFViewThumbAsyncDelegate, object)
Retrieves the specified thumbnail from the persistent thumbnail cache on disk, then calls proc on the resulting thumbnail.
Declaration
public void GetThumbAsync(int page_num, PDFViewThumbAsyncDelegate managed_proc, object custom_data)
Parameters
Type | Name | Description |
---|---|---|
int | page_num | The page number of the thumbnail. |
PDFViewThumbAsyncDelegate | managed_proc | A callback function that will be called after the thumbnail is retrieved, or if that retrieval fails. |
object | custom_data | Custom data to be passed as a parameter to 'managed_proc'. |
GetToolMode()
Gets the current tool mode.
Declaration
public PDFViewCtrl.ToolMode GetToolMode()
Returns
Type | Description |
---|---|
PDFViewCtrl.ToolMode | current tool mode. |
GetVScrollPos()
Gets the current vertical scroll position in scrollable space.
Declaration
public double GetVScrollPos()
Returns
Type | Description |
---|---|
double | Gets the current vertical scroll position. |
GetViewHeight()
Gets the width of the main view in pixels.
Declaration
public int GetViewHeight()
Returns
Type | Description |
---|---|
int | the width of the main view in pixels. |
GetViewWidth()
Gets the width of the main view in pixels.
Declaration
public int GetViewWidth()
Returns
Type | Description |
---|---|
int | the width of the main view in pixels. |
GetVisiblePages()
Gets the pages that are currently visible on the screen
Declaration
public int[] GetVisiblePages()
Returns
Type | Description |
---|---|
int[] | An array of pages visible on the screen |
GetZoom()
Gets current zoom (or scaling) component used to display the page content.
Declaration
public double GetZoom()
Returns
Type | Description |
---|---|
double | current zoom (or scaling) component used to display the page content. |
GotoFirstPage()
Sets the current page to the first page in the document.
Declaration
public bool GotoFirstPage()
Returns
Type | Description |
---|---|
bool | true if successful, false otherwise. |
GotoLastPage()
Sets the current page to the last page in the document.
Declaration
public bool GotoLastPage()
Returns
Type | Description |
---|---|
bool | true if successful, false otherwise. |
GotoNextPage()
Sets the current page to the next page in the document.
Declaration
public bool GotoNextPage()
Returns
Type | Description |
---|---|
bool | true if successful, false otherwise. |
GotoPreviousPage()
Sets the current page to the previous page in the document.
Declaration
public bool GotoPreviousPage()
Returns
Type | Description |
---|---|
bool | true if successful, false otherwise. |
HasSelection()
checks if there is selection
Declaration
public bool HasSelection()
Returns
Type | Description |
---|---|
bool | return true if there is selection, false otherwise. |
HasSelectionOnPage(int)
checks if given page number has any text selection on it. Useful when there are selections on multiple pages at the same time.
Declaration
public bool HasSelectionOnPage(int page)
Parameters
Type | Name | Description |
---|---|---|
int | page | given page number |
Returns
Type | Description |
---|---|
bool | true if given page number has any text selection on it, false otherwise |
HideAnnotation(Annot)
Disable rendering of a particular annotation. This does not change the annotation itself, just how it is displayed in this viewer instance.
Declaration
public void HideAnnotation(Annot annot)
Parameters
Type | Name | Description |
---|---|---|
Annot | annot | The annotation object to cease drawing for. |
InsertBlankPages()
create InsertBlankPagesDialog to prompt user for size and number of blank pages to insert.
Declaration
public void InsertBlankPages()
Remarks
Can acquire a write lock on the document
InsertPages()
create InsertPagesDialog to prompt user for page number from another PDF document to insert.
Declaration
public void InsertPages()
Remarks
Can acquire a write lock on the document
InsertPages(string)
create InsertPagesDialog to prompt user for page number from another PDF document to insert.
Declaration
public void InsertPages(string path)
Parameters
Type | Name | Description |
---|---|---|
string | path | path to the PDF document as insertion source |
Remarks
Can acquire a write lock on the document
IsFinishedRendering()
checks if the rendering thread has finished.
Declaration
public bool IsFinishedRendering()
Returns
Type | Description |
---|---|
bool | true if the rendering thread has finished, false otherwise. |
IsFinishedRendering(bool)
checks if the rendering thread has finished or the current visible region has been fully rendered.
Declaration
public bool IsFinishedRendering(bool visible_region_only)
Parameters
Type | Name | Description |
---|---|---|
bool | visible_region_only | DFViewCtrl might pre-render invisible regions if the compatibility parameter is set to false when its constructor is called. In this case, the rendering thread might still be ongoing even if the current visible region has been rendered. If visible_region_only parameter is set to true, this function only checks if the visible region has been rendered, regardless if the rendering thread is ongoing. If compatibility parameter is set to true when its constructor is called, this parameter takes no effect. |
Returns
Type | Description |
---|---|
bool | true if the rendering thread has finished or the current visible region has been fully rendered, false otherwise. |
IsNavPanelVisible()
Checks if navigation panel is visible
Declaration
public bool IsNavPanelVisible()
Returns
Type | Description |
---|---|
bool | true if navigation panel is visible |
LoadCurrentConfiguration(string)
Load the current configuration of PDFViewCtrl from a file.
Declaration
public void LoadCurrentConfiguration(string path)
Parameters
Type | Name | Description |
---|---|---|
string | path | path of the file from which the settings are loaded. If it is an empty string, default location is chosen by PDFViewCtrl. |
OnAction(Action)
Called whenever any action is being triggered in the PDF doc.
Declaration
public virtual bool OnAction(Action action)
Parameters
Type | Name | Description |
---|---|---|
Action | action | The action about to be executed on the PDF doc. |
Returns
Type | Description |
---|---|
bool | Return true to prevent PDFViewCtrl from executing the action, otherwise false. |
OnBackColorChanged(EventArgs)
When overriding OnBackColorChanged in a derived class, be sure to call the base class's OnBackColorChanged method so that registered delegates receive the event.
Declaration
public override void OnBackColorChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
EventArgs | e | event arguments |
Overrides
OnContextMenu(int, int)
Declaration
protected virtual void OnContextMenu(int x, int y)
Parameters
Type | Name | Description |
---|---|---|
int | x | |
int | y |
OnCursorChanged(EventArgs)
Raises the CursorChanged event.
Declaration
protected override void OnCursorChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
EventArgs | e | An EventArgs that contains the event data. |
Overrides
OnForeColorChanged(EventArgs)
When overriding OnForeColorChanged in a derived class, be sure to call the base class's OnBackColorChanged method so that registered delegates receive the event.
Declaration
public override void OnForeColorChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
EventArgs | e | event arguments |
Overrides
OnInvalidated(InvalidateEventArgs)
Raises the Invalidated event.
Declaration
protected override void OnInvalidated(InvalidateEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
InvalidateEventArgs | e | An InvalidateEventArgs that contains the event data. |
Overrides
OnKeyDown(KeyEventArgs)
Raises the KeyDown event.
Declaration
protected override void OnKeyDown(KeyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
KeyEventArgs | e | A KeyEventArgs that contains the event data. |
Overrides
OnKeyPress(KeyPressEventArgs)
Raises the KeyPress event.
Declaration
protected override void OnKeyPress(KeyPressEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
KeyPressEventArgs | e | A KeyPressEventArgs that contains the event data. |
Overrides
OnKeyUp(KeyEventArgs)
Raises the KeyUp event.
Declaration
protected override void OnKeyUp(KeyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
KeyEventArgs | e | A KeyEventArgs that contains the event data. |
Overrides
OnMouseClick(MouseEventArgs)
Raises the MouseClick event.
Declaration
protected override void OnMouseClick(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
MouseEventArgs | e | An MouseEventArgs that contains the event data. |
Overrides
OnMouseDoubleClick(MouseEventArgs)
Raises the MouseDoubleClick event.
Declaration
protected override void OnMouseDoubleClick(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
MouseEventArgs | e | An MouseEventArgs that contains the event data. |
Overrides
OnMouseDown(MouseEventArgs)
Raises the MouseDown event.
Declaration
protected override void OnMouseDown(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
MouseEventArgs | e | A MouseEventArgs that contains the event data. |
Overrides
OnMouseEnter(EventArgs)
Raises the MouseEnter event.
Declaration
protected override void OnMouseEnter(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
EventArgs | e | An EventArgs that contains the event data. |
Overrides
OnMouseLeave(EventArgs)
Raises the MouseLeave event.
Declaration
protected override void OnMouseLeave(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
EventArgs | e | An EventArgs that contains the event data. |
Overrides
OnMouseMove(MouseEventArgs)
Raises the MouseMove event.
Declaration
protected override void OnMouseMove(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
MouseEventArgs | e | A MouseEventArgs that contains the event data. |
Overrides
OnMouseUp(MouseEventArgs)
Raises the MouseUp event.
Declaration
protected override void OnMouseUp(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
MouseEventArgs | e | A MouseEventArgs that contains the event data. |
Overrides
OnMouseWheel(MouseEventArgs)
Raises the MouseWheel event.
Declaration
protected override void OnMouseWheel(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
MouseEventArgs | e | A MouseEventArgs that contains the event data. |
Overrides
OnResize(EventArgs)
Raises the Resize event.
Declaration
protected override void OnResize(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
EventArgs | e | An EventArgs that contains the event data. |
Overrides
OnScroll(int, int)
Scrolls the contents of the rendering buffer 'pix_dx' horizontally and 'pix_dy' vertically.
Declaration
public void OnScroll(int pix_dx, int pix_dy)
Parameters
Type | Name | Description |
---|---|---|
int | pix_dx | horizontal scroll offset, in pixels |
int | pix_dy | vertical scroll offset, in pixels |
OnUserPaint(void*)
Declaration
protected virtual bool OnUserPaint(void* dc)
Parameters
Type | Name | Description |
---|---|---|
void* | dc |
Returns
Type | Description |
---|---|
bool |
OpenURLAsync(string)
Open a PDF file at the given url. This works best with PDF's that are linearized, as pages can be downloaded and viewed in random access order, without the need to download the entire document.
Declaration
public void OpenURLAsync(string url)
Parameters
Type | Name | Description |
---|---|---|
string | url | the url to open |
Remarks
Use SetDownloadReportHandler to track the download events.
OpenURLAsync(string, string, string)
Open a PDF file at the given url. This works best with PDF's that are linearized, as pages can be downloaded and viewed in random access order, without the need to download the entire document. A viewing session can also be persisted across multiple viewing/application sessions to remove redundant downloads and improve overall performance by using the optional cache_pdf parameter.
Declaration
public void OpenURLAsync(string url, string cache_pdf, string password)
Parameters
Type | Name | Description |
---|---|---|
string | url | the url to open |
string | cache_pdf | This function will use downloaded data to construct a PDF in this location. If null or blank, the PDF will be stored in a temporary location. If the path points to the result of a previous call to this function for this particular URL, then PDFViewCtrl will resume that download. Note that if disk caching is disabled this file will not be used. |
string | password | The PDF document password to use if the PDF itself is password protected. |
Remarks
Use SetDownloadReportHandler to track the download events.
OpenURLAsync(string, string, string, HTTPRequestOptions)
Open a PDF file at the given url. This works best with PDF's that are linearized, as pages can be downloaded and viewed in random access order, without the need to download the entire document. A viewing session can also be persisted across multiple viewing/application sessions to remove redundant downloads and improve overall performance by using the optional cache_pdf parameter.
Declaration
public void OpenURLAsync(string url, string cache_pdf, string password, HTTPRequestOptions options)
Parameters
Type | Name | Description |
---|---|---|
string | url | the url to open |
string | cache_pdf | This function will use downloaded data to construct a PDF in this location. If null or blank, the PDF will be stored in a temporary location. If the path points to the result of a previous call to this function for this particular URL, then PDFViewCtrl will resume that download. |
string | password | The PDF document password to use if the PDF itself is password protected. |
HTTPRequestOptions | options | Optional HTTP request options to use with every HTTP request. |
Remarks
Use SetDownloadReportHandler to track the download events.
Print()
Displays a print dialog to receive information from the user and prints the document.
Declaration
public void Print()
Remarks
Can acquire a write lock on the document
Print(int, int, Rotate, int, string)
print a range of pages with specified rotation and number of copies to target printer
Declaration
public void Print(int first_page, int last_page, Page.Rotate rotation, int copies, string printer_name)
Parameters
Type | Name | Description |
---|---|---|
int | first_page | first page to print |
int | last_page | last page to print |
Page.Rotate | rotation | page rotation |
int | copies | number of copies to print |
string | printer_name | name of the target printer |
Remarks
Acquires a write lock on the document
ReplacePages()
create ReplacePagesDialog to prompt user for page number from another PDF document to replace pages from current PDF document
Declaration
public void ReplacePages()
Remarks
Can acquire a write lock on the document
ReplacePages(string)
create ReplacePagesDialog to prompt user for page number from another PDF document to replace pages from current PDF document
Declaration
public void ReplacePages(string path)
Parameters
Type | Name | Description |
---|---|---|
string | path | path to the PDF document as replacement source |
Remarks
Can acquire a write lock on the document
RequestRendering()
Requests that PDFViewCtrl start rendering, if necessary.
Declaration
public void RequestRendering()
Remarks
Invalidate() simply causes the window to be repainted at the system level. It does not make PDFViewCtrl to render anything new. RequestRendering() tells PDFViewCtrl to check if there are regions (both visible and invisible) that have not been rendered; if so a background rendering thread will be started. This function should be called if CancelRendering() was called to stop the ongoing rendering thread. Update() tells PDFViewCtrl to discard the rendered content and start a rendering thread. This function should be used if the content of the PDF is modified.
Resize(int, int)
resizes PDFViewCtrl to the specified width and height
Declaration
public void Resize(int w, int h)
Parameters
Type | Name | Description |
---|---|---|
int | w | new width |
int | h | new height |
RotateClockwise()
Rotates all pages in the document 90 degrees clockwise.
Declaration
public void RotateClockwise()
RotateCounterClockwise()
Rotates all pages in the document 90 degrees counter-clockwise.
Declaration
public void RotateCounterClockwise()
RotatePages()
create RotatePagesDialog to prompt user to rotate n pages at a specified rotation
Declaration
public void RotatePages()
Remarks
Can acquire a write lock on the document
SaveCurrentConfiguration(string)
Save the current configuration of PDFViewCtrl to a file.
Declaration
public void SaveCurrentConfiguration(string path)
Parameters
Type | Name | Description |
---|---|---|
string | path | name of the file to which the settings are saved. If it is an empty string, default location is chosen by PDFViewCtrl. |
Select(double, double, double, double)
Selects text within the given region using the current text selection mode.
Declaration
public bool Select(double x1, double y1, double x2, double y2)
Parameters
Type | Name | Description |
---|---|---|
double | x1 | x coordinate of the a point |
double | y1 | y coordinate of the a point |
double | x2 | x coordinate of the opposite corner |
double | y2 | y coordinate of the opposite corner |
Returns
Type | Description |
---|---|
bool | true if some text was selected, false otherwise. |
Select(double, double, int, double, double, int)
Selects text using structural mode given two points on two pages.
Declaration
public bool Select(double x1, double y1, int page1, double x2, double y2, int page2)
Parameters
Type | Name | Description |
---|---|---|
double | x1 | x coordinate of the first point |
double | y1 | y coordinate of the first point |
int | page1 | page number of the first page |
double | x2 | x coordinate of the second point |
double | y2 | y coordinate of the second point |
int | page2 | page number of the second page |
Returns
Type | Description |
---|---|
bool | true if some text was selected, false otherwise. |
Select(Highlights)
Declaration
public bool Select(Highlights highlights)
Parameters
Type | Name | Description |
---|---|---|
Highlights | highlights |
Returns
Type | Description |
---|---|
bool |
Select(Selection)
Declaration
public bool Select(PDFViewCtrl.Selection select)
Parameters
Type | Name | Description |
---|---|---|
PDFViewCtrl.Selection | select |
Returns
Type | Description |
---|---|
bool |
SelectAll()
Selects all text on the page.
Declaration
public void SelectAll()
SetAnnotationEditPermissionHandler(PDFViewAnnotationEditPermissionDelegate, object)
Sets the function to be called when a user attempts to edit an annotation.
Declaration
public void SetAnnotationEditPermissionHandler(PDFViewAnnotationEditPermissionDelegate edit_proc, object data)
Parameters
Type | Name | Description |
---|---|---|
PDFViewAnnotationEditPermissionDelegate | edit_proc | Handling callback function (or delegate in .NET) |
object | data | Custom data to be passed as a second parameter to 'edit_proc'. |
SetAntiAliasing(bool)
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).
Declaration
public void SetAntiAliasing(bool enable_aa)
Parameters
Type | Name | Description |
---|---|---|
bool | enable_aa | whether to enable Anti-aliasing |
Remarks
Anti-aliasing is enabled by default.
SetBackgroundColor(Color)
Sets the default background color used to paint the area surrounding each page.
Declaration
public void SetBackgroundColor(Color c)
Parameters
Type | Name | Description |
---|---|---|
Color | c | RGB color specifying the default background color. |
SetCaching(bool)
Enables of disables caching of images, fonts, and other resources. Disabling caching can lower memory requirements at the expense of rendering speed.
Declaration
public void SetCaching(bool enabled)
Parameters
Type | Name | Description |
---|---|---|
bool | enabled | if true caching is enabled, if false caching is disabled. by default caching is enabled |
SetColorPostProcessMode(ColorPostProcessMode)
Draws the page into a given memory buffer. 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.
Declaration
public void SetColorPostProcessMode(PDFRasterizer.ColorPostProcessMode mode)
Parameters
Type | Name | Description |
---|---|---|
PDFRasterizer.ColorPostProcessMode | mode | mode is the specific transform to be applied. |
SetCurrentPage(int)
Sets the current page to the given page.
Declaration
public bool SetCurrentPage(int page_num)
Parameters
Type | Name | Description |
---|---|---|
int | page_num | new page number |
Returns
Type | Description |
---|---|
bool | true if successful, false otherwise. |
SetCurrentPageHandler(PDFViewCurrentPageDelegate, object)
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.
Declaration
public void SetCurrentPageHandler(PDFViewCurrentPageDelegate curr_page_proc, object data)
Parameters
Type | Name | Description |
---|---|---|
PDFViewCurrentPageDelegate | curr_page_proc | Callback function (or a delegate in .NET). |
object | data | Custom data to be passed as a second parameter to 'curr_pagenum_proc'. |
SetDefaultPageColor(Color)
Sets the default 'paper' color used to draw background of each page.
Declaration
public void SetDefaultPageColor(Color c)
Parameters
Type | Name | Description |
---|---|---|
Color | c | RGB color specifying the default page color. |
SetDoc(PDFDoc)
Associates this PDFViewCtrl with a given PDF document.
Declaration
public bool SetDoc(PDFDoc doc)
Parameters
Type | Name | Description |
---|---|---|
PDFDoc | doc | A document to be displayed in the view. |
Returns
Type | Description |
---|---|
bool | true if operation is successful, false otherwise. |
Remarks
Acquires a write lock on the document
SetDoc(PDFDoc, string)
Associates this PDFViewCtrl with a given PDF document.
Declaration
public bool SetDoc(PDFDoc doc, string password)
Parameters
Type | Name | Description |
---|---|---|
PDFDoc | doc | A document to be displayed in the view. |
string | password | the password used to initialize the document |
Returns
Type | Description |
---|---|
bool | true if operation is successful, false otherwise. |
SetDownloadReportHandler(PDFViewDownloadDelegate, object)
Sets the download report handling function to be called on download events, such as when a new page or thumbnail is available, and any download related errors.
Declaration
public void SetDownloadReportHandler(PDFViewDownloadDelegate download_proc, object data)
Parameters
Type | Name | Description |
---|---|---|
PDFViewDownloadDelegate | download_proc | Download report handling callback function (or delegate in .NET) |
object | data | Custom data to be passed as a parameter to 'download_proc'. |
SetDrawAnnotations(bool)
Enable or disable annotation and forms rendering. By default, all annotations and form fields are rendered.
Declaration
public void SetDrawAnnotations(bool render_annots)
Parameters
Type | Name | Description |
---|---|---|
bool | render_annots | True to draw annotations, false otherwise. |
SetEnabledPanels(int)
Sets which panels will be enabled in the navigation panel.
Declaration
public void SetEnabledPanels(int panels)
Parameters
Type | Name | Description |
---|---|---|
int | panels | A bit field composed of an OR of PDFViewCtrl::PanelType values. |
SetErrorReportHandler(PDFViewErrorDelegate, object)
Sets the error handling function to be called in case an error is encountered during page rendering.
Declaration
public void SetErrorReportHandler(PDFViewErrorDelegate error_proc, object data)
Parameters
Type | Name | Description |
---|---|---|
PDFViewErrorDelegate | error_proc | Error handling callback function (or delegate in .NET) |
object | data | Custom data to be passed as a second parameter to 'error_proc'. |
SetFindTextHandler(PDFViewFindTextAsyncDelegate, object)
Sets the delegate to be called when FindTextAsync() is completed
Declaration
public void SetFindTextHandler(PDFViewCtrl.PDFViewFindTextAsyncDelegate proc, object data)
Parameters
Type | Name | Description |
---|---|---|
PDFViewCtrl.PDFViewFindTextAsyncDelegate | proc | the delegate |
object | data | arbitrary user data |
SetFocus()
Set the key focus to PDFViewCtrl. This is useful when a user needs to set the focus programatically.
Declaration
public void SetFocus()
SetGamma(double)
Sets the gamma factor used for anti-aliased rendering. 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).
Declaration
public void SetGamma(double exp)
Parameters
Type | Name | Description |
---|---|---|
double | exp | exponent value of gamma function. Typical values are in the range from 0.1 to 3. |
Remarks
Gamma correction is used only in the built-in rasterizer.
SetHScrollPos(double)
Sets the horizontal scroll position in scrollable space.
Declaration
public void SetHScrollPos(double pos)
Parameters
Type | Name | Description |
---|---|---|
double | pos | new horizontal scroll position. |
SetHighlightFields(bool)
Enable or disable highlighting form fields. Default is disabled.
Declaration
public void SetHighlightFields(bool highlight_fields)
Parameters
Type | Name | Description |
---|---|---|
bool | highlight_fields | true to highlight, false otherwise. |
SetHorizontalAlign(int)
Sets the horizontal alignment used for rendering pages within the view.
Declaration
public void SetHorizontalAlign(int align)
Parameters
Type | Name | Description |
---|---|---|
int | align | an integer specifying the horizontal alignment. Depending of whether align is positive, negative, or zero - pages will be right, left or center aligned |
SetImageSmoothing(bool)
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.
Declaration
public void SetImageSmoothing(bool smoothing_enabled)
Parameters
Type | Name | Description |
---|---|---|
bool | smoothing_enabled | True to enable image smoothing, false otherwise. image smoothing is enabled. |
Remarks
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.
SetOCGContext(Context)
Declaration
public void SetOCGContext(Context ctx)
Parameters
Type | Name | Description |
---|---|---|
Context | ctx |
SetOverprint(OverprintPreviewMode)
Enable or disable support for overprint. Overprint is a device dependent feature and the results will vary depending on the output color space and supported colorants (i.e. CMYK, CMYK+spot, RGB, etc). By default overprint is enabled for only PDF/X files.
Declaration
public void SetOverprint(PDFRasterizer.OverprintPreviewMode op)
Parameters
Type | Name | Description |
---|---|---|
PDFRasterizer.OverprintPreviewMode | op | e_op_on: always enabled; e_op_off: always disabled; e_op_pdfx_on: enabled for PDF/X files only. |
SetPageBorderVisibility(bool)
Enables or disables drawing of a thin border around each page.
Declaration
public void SetPageBorderVisibility(bool border_visible)
Parameters
Type | Name | Description |
---|---|---|
bool | border_visible | if true, the border will be visible. |
SetPagePresentationMode(PagePresentationMode)
Sets the current page presentation mode.
Declaration
public void SetPagePresentationMode(PDFViewCtrl.PagePresentationMode mode)
Parameters
Type | Name | Description |
---|---|---|
PDFViewCtrl.PagePresentationMode | mode | the new page presentation mode. The default PagePresentationMode is e_single_continuous. |
SetPageSpacing(int, int, int, int)
Sets the vertical and horizontal padding and column spacing between adjacent pages in the view.
Declaration
public void SetPageSpacing(int horiz_space, int vert_space, int horiz_pad, int vert_pad)
Parameters
Type | Name | Description |
---|---|---|
int | horiz_space | horizontal column spacing (represented in pixels) between adjacent pages in the view. Default is 10. |
int | vert_space | vertical column spacing (represented in pixels) between adjacent pages in the view. Default is 10. |
int | horiz_pad | horizontal padding (represented in pixels) on the left and right side of the view. Default is 10. |
int | vert_pad | vertical padding (represented in pixels) on the top and bottom side of the view. Default is 10. |
SetPageTransparencyGrid(bool)
Enables or disables the transparency grid (check board pattern) to reflect page transparency.
Declaration
public void SetPageTransparencyGrid(bool trans_grid_visible)
Parameters
Type | Name | Description |
---|---|---|
bool | trans_grid_visible | if true, the grid is turned on. |
SetPageViewMode(PageViewMode)
the new page viewing mode. The default PageView mode is e_fit_width.
Declaration
public void SetPageViewMode(PDFViewCtrl.PageViewMode mode)
Parameters
Type | Name | Description |
---|---|---|
PDFViewCtrl.PageViewMode | mode | Sets the page viewing mode. |
SetPathHinting(bool)
Enable or disable path hinting. Path hinting is used to slightly adjust paths in order to avoid or alleviate artifacts of hair line cracks between certain graphical elements. This option is turned on by default.
Declaration
public void SetPathHinting(bool enable_ph)
Parameters
Type | Name | Description |
---|---|---|
bool | enable_ph | whether to enable path hinting. |
SetProgressiveRendering(bool)
Sets whether the control will render progressively or will just draw once the entire view has been rendered. Progressive rendering is useful when a PDF page contain lots of elements (e.g. many vector paths, text, or many little images). When progressive rendering is enabled PDFNet will use painter algorithm to draw the page. This way user may be able to see partially rendered page. If a page contains only a single large image, there would be no visible benefit from progressive rendering.
Declaration
public void SetProgressiveRendering(bool is_progressive)
Parameters
Type | Name | Description |
---|---|---|
bool | is_progressive | if true the view will be rendered progressively |
SetRasterizerType(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.
Declaration
public void SetRasterizerType(PDFRasterizer.Type type)
Parameters
Type | Name | Description |
---|---|---|
PDFRasterizer.Type | type | Rasterizer type. |
Remarks
This method is deprecated, since the GDI+ rasterizer itself is deprecated and will be removed in a future version of PDFNet. It is strongly recommended to use the built-in rasterizer and to use the XPS print path where vector conversion is needed.
SetRequestRenderInWorkerThreadProc(PDFViewRenderWorkerDelegate, object)
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.
Declaration
public void SetRequestRenderInWorkerThreadProc(PDFViewCtrl.PDFViewRenderWorkerDelegate managed_proc, object custom_data)
Parameters
Type | Name | Description |
---|---|---|
PDFViewCtrl.PDFViewRenderWorkerDelegate | managed_proc | The callback function. |
object | custom_data | Custom data to be passed as a parameter to 'managed_proc'. |
SetSelectedPanel(PanelType)
Sets the currently selected panel in the navigation panel.
Declaration
public void SetSelectedPanel(PDFViewCtrl.PanelType panel)
Parameters
Type | Name | Description |
---|---|---|
PDFViewCtrl.PanelType | panel | the panel to select |
SetSplitPosition(int)
Sets the horizontal size of the navigation panel.
Declaration
public void SetSplitPosition(int pos)
Parameters
Type | Name | Description |
---|---|---|
int | pos | the new horizontal size |
SetTextSelectionMode(TextSelectionMode)
Selects all words that intersect the given selection rectangle.
Declaration
public void SetTextSelectionMode(PDFViewCtrl.TextSelectionMode tm)
Parameters
Type | Name | Description |
---|---|---|
PDFViewCtrl.TextSelectionMode | tm | the text selection mode. |
SetThinLineAdjustment(bool, bool)
Set thin line adjustment parameters.
Declaration
public void SetThinLineAdjustment(bool pixel_grid_fit, bool stroke_adjust)
Parameters
Type | Name | Description |
---|---|---|
bool | 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. |
bool | 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. |
SetToolMode(ToolMode)
Sets the new tool mode (such as pan, text select, etc).
Declaration
public void SetToolMode(PDFViewCtrl.ToolMode mode)
Parameters
Type | Name | Description |
---|---|---|
PDFViewCtrl.ToolMode | mode | new tool mode. |
SetUrlExtraction(bool)
Enables or disables URL extraction. Default is disabled.
Declaration
public void SetUrlExtraction(bool enabled)
Parameters
Type | Name | Description |
---|---|---|
bool | enabled | true to enable URL extraction, false to disable. |
Remarks
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.
SetVScrollPos(double)
Sets the vertical scroll position in scrollable space.
Declaration
public void SetVScrollPos(double pos)
Parameters
Type | Name | Description |
---|---|---|
double | pos | new vertical scroll position. |
SetVerticalAlign(int)
Sets the vertical alignment used for rendering pages within the view.
Declaration
public void SetVerticalAlign(int align)
Parameters
Type | Name | Description |
---|---|---|
int | align | an integer specifying the vertical alignment. Depending of whether align is positive, negative, or zero pages will be bottom, top or center aligned |
SetViewerCache(SDFDoc, uint, bool)
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.
Declaration
public static void SetViewerCache(SDFDoc document, uint max_cache_size, bool on_disk)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | document | The document whose settings will be modified |
uint | max_cache_size | The maximum size, in bytes, of the entire document's page cache. Set to zero to disable the viewer cache. |
bool | 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. |
Remarks
Default Desktop: max_cache_size = 512 MB, on_disk = true | Default Mobile: max_cache_size = 100 MB, on_disk = false
SetZoom(double)
Sets the zoom factor to a new value. The function zooms to a point at the center of the rendering buffer.
Declaration
public bool SetZoom(double zoom)
Parameters
Type | Name | Description |
---|---|---|
double | zoom | new scaling component used to display the page content. |
Returns
Type | Description |
---|---|
bool | true if successful, false otherwise. |
SetZoom(int, int, double)
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 coordinate system, 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);
Declaration
public bool SetZoom(int x, int y, double zoom)
Parameters
Type | Name | Description |
---|---|---|
int | x | the horizontal coordinate to zoom in. |
int | y | the vertical coordinate to zoom in. |
double | zoom | new scaling component used to display the page content. |
Returns
Type | Description |
---|---|
bool | true if successful, false otherwise. |
SetupThumbnails(bool, bool, bool, int, uint, double)
Enables or disables thumbnail view features. Thumbnail view is used before a PDF page is fully rendered. If runtime thumb view generation is enabled, PDFViewCtrl generates thumbnail views at runtime. If a PDF file already contains the thumbnail views, runtime thumb view generation can be turned off, which is more efficient.
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.
If runtime thumb view generation is enabled, the thumbMaxSideLength will be used as a reference to calculate the thumbnail resolution.
Declaration
public void SetupThumbnails(bool use_embedded_thumbs, bool generate_thumbs_at_runtime, bool use_persistent_cache, int thumb_max_side_length, uint max_abs_cache_size, double max_perc_cache_size)
Parameters
Type | Name | Description |
---|---|---|
bool | use_embedded_thumbs | Enables or disables using thumbnails embedded in the PDF document as a preview of the rendered page. This flag is currently ignored, but functionality may be added to support embedded thumbnails in the future. |
bool | generate_thumbs_at_runtime | Enables or disables generating thumbnails at runtime. Default is enabled. |
bool | use_persistent_cache | Enables or disables storing thumbnails in a cache file on disk. default is enabled. |
int | thumb_max_side_length | The maximum size, in pixels, of a dimension of generated thumbnails. |
uint | max_abs_cache_size | The maximum absolute size, in bytes, the thumbnail cache file may take up on disk. |
double | max_perc_cache_size | The maximum percentage of free disk space, in the range 0 - 1.0, the thumbnail cache file may take up. |
ShowAnnotation(Annot)
Enable rendering of a particular annotation. Only has an effect if HideAnnotation() has previously been called on the same annot.
Declaration
public void ShowAnnotation(Annot annot)
Parameters
Type | Name | Description |
---|---|---|
Annot | annot | The annotation object to resume rendering. |
ShowDialogs(bool)
Enables or disables popup dialogs such as password entry and find dialogs as well as popup menus.
Declaration
public void ShowDialogs(bool show)
Parameters
Type | Name | Description |
---|---|---|
bool | show | if true dialogs will be enabled |
ShowMenuBar(bool)
Enables or disables the menu bar that gives access to the PDFViewCtrl user functions.
Declaration
public void ShowMenuBar(bool show)
Parameters
Type | Name | Description |
---|---|---|
bool | show | if true the menu bar will be enabled. |
ShowNavPanel(bool)
Enables or disables the navigation panel.
Declaration
public void ShowNavPanel(bool show)
Parameters
Type | Name | Description |
---|---|---|
bool | show | if true the navigation panel will be enabled |
ShowNavToolbar(bool)
Enables or disables the toolbar controlling the navigation panel.
Declaration
public void ShowNavToolbar(bool show)
Parameters
Type | Name | Description |
---|---|---|
bool | show | if true the navigation toolbar will be enabled. |
ShowRect(int, 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.
Declaration
public bool ShowRect(int page_num, Rect rect)
Parameters
Type | Name | Description |
---|---|---|
int | page_num | given page number |
Rect | rect | rectangle specifies the region to show in view |
Returns
Type | Description |
---|---|
bool | true if successful, false otherwise. |
ShowStatusBar(bool)
Enables or disables the status bar at the bottom of the viewing area.
Declaration
public void ShowStatusBar(bool show)
Parameters
Type | Name | Description |
---|---|---|
bool | show | if true the status bar will be enabled. |
ShowToolbar(bool)
Enables or disables the toolbar on top of the viewing area.
Declaration
public void ShowToolbar(bool show)
Parameters
Type | Name | Description |
---|---|---|
bool | show | if true the toolbar will be enabled. |
SmartZoom(int, int)
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).
Declaration
public bool SmartZoom(int x, int y)
Parameters
Type | Name | Description |
---|---|---|
int | x | the horizontal coordinate to look for a paragraph. |
int | y | the vertical coordinate to look for a paragraph. |
Returns
Type | Description |
---|---|
bool | true if successful, false if no paragraph intersects the given point. |
Update()
Redraws the contents in the visible region.
Declaration
public void Update()
Update(bool)
Redraws the contents.
Declaration
public void Update(bool all)
Parameters
Type | Name | Description |
---|---|---|
bool | all | If true, all the rendered contents are discarded and re-rendered; otherwise, only the visible region will be re-rendered. |
Update(Annot, int)
Redraws the area covered with a given annotation.
Declaration
public void Update(Annot annot, int page_num)
Parameters
Type | Name | Description |
---|---|---|
Annot | annot | The annotation to update. |
int | page_num | The page number on which the annotation is located. |
Update(Field)
Redraws all instances (Widgets) of the field.
Declaration
public void Update(Field field)
Parameters
Type | Name | Description |
---|---|---|
Field | field | he field for which to update all occurances. |
Update(Rect)
Declaration
public void Update(Rect update_rect)
Parameters
Type | Name | Description |
---|---|---|
Rect | update_rect |
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).
Declaration
public void UpdatePageLayout()