# GraffitiPDFViewer
Class Inherits GraffitiWebUIControl
## About
GraffitiPDFViewer is a purpose-built PDF Viewer for your Xojo applications. Using the industry standard PDF.js, loading and displaying PDF files is a breeze.
Supported Features:
*
Open Document by URL
*
Open Document by FolderItem
*
Print
*
Text Selection
*
Annotation Display
*
Embedded External Links
*
Page to Image
*
Page to Text
## Preview

Previous
Next
## Warnings
### Linux Support
Support varies by Linux distribution and installed libwebkit library and version.
### Windows Support
Requires the presence of an HTMLViewer on a window or container within the project.
## Compatibility
### Framework API Version
| 1.0 | 2.0 |
| :---: | :---: |
| True | True |
### Desktop
| 32-Bit | 64-Bit |
| :---: | :---: |
| True | True |
## Enumerations
| Name | Value | Description |
| --- | :---: | --- |
| DisplayModes | Vertical <br> Horizontal | Supported display orientation modes. |
## Event Definitions
| Name | Parameters | Return Type | Description |
| --- | :---: | :---: | --- |
| Error | code as Integer <br> name as String <br> message as String | (None) | Raised when the viewer has encountered an exception. See table of possible errors below. |
| FileDropped | Name as String <br> Content as String | Boolean | A file has been dropped on the control. Return True to cancel default loading. |
| FileDroppedInvalid | filename as String <br> filetype as String | (None) | Raised when the user drops an unexpected file type on the viewer (IE: Anything except a PDF). |
| FocusReceived | (None) | (None) | |
| PageChanged | (None) | (None) | Raised when the user has navigated to a different page. |
| Rendered | (None) | (None) | Raised when a PDF document is successfully loaded. |
| SavePressed | (None) | (None) | Raised when the user has clicked the Save button in the toolbar. You may wish to maintain an independent reference to the file upon loading for save operations, or call the SaveDocument method. |
| ZoomChanged | (None) | (None) | Raised when the user has changed the zoom level. |
## Methods
| Name | Parameters | Return Type | Description |
| --- | :---: | :---: | --- |
| Sub | CloseDocument | (None) | Closes the currently viewed document. |
| Sub | Find | (None) | Finds and highlights the supplied text instances in the viewer. |
| Sub | FitHeight | (None) | Fits the zoom level to show the current page's full height. |
| Sub | FitPage | (None) | Fits the zoom level to show the current page in its entirety. |
| Sub | FitWidth | (None) | Fits the zoom level to show current page's full width. |
| Sub | OpenDocument | (None) | Opens the specified document. |
| Sub | OpenDocument | (None) | Opens the specified document. |
| Function | PageContentAt | As | Returns the text content of the specified page. |
| Function | PageImage | As | Returns an image of the specified page. |
| Function | PageIndex | As | The current page index. |
| Function | PageLastIndex | As | Index of the last page in the document. |
| Sub | Print | (None) | Prints the current document. |
| Sub | Rotate | (None) | Rotates the document. value represents degrees of rotation. |
| Sub | SaveDocument | (None) | Saves the currently loaded document to the specified path. |
| Sub | ScrollToPage | (None) | Scrolls the viewer to show the specified page. |
| Function | Zoom | As | Returns the current zoom level. |
| Sub | Zoom | (None) | Returns the current zoom level. |
| Sub | ZoomIn | (None) | Zooms in by 25%. |
| Sub | ZoomOut | (None) | Zooms out by 25%. |
## Properties
| Name | Type | Default Value | Description |
| --- | :---: | :---: | --- |
| DisplayMode | DisplayModes | Nil | The current page display orientation. |
| dragTimer | Timer | Nil | |
| Enabled | Boolean | Nil | |
| FileDropAllowed | Boolean | Nil | Determines whether users are allowed to drop files on the viewer to load them. |
| FileDropCaption | String | Nil | Text displayed in file drop overlay. |
| FileDropCaptionWorking | String | Nil | Text displayed while the control attempts to load the dropped file. |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | = | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | = | |
| Private | As | Nil | |
| Private | | Picture | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| Private | As | Nil | |
| SidebarVisible | Boolean | Nil | Determines whether the thumbnail sidebar is visible. |
| TextDisplayHorizontal | String | Nil | Localizable string to display in viewer toolbar. |
| TextDisplayVertical | String | Nil | Localizable string to display in viewer toolbar. |
| TextDownload | String | Nil | Localizable string to display in viewer toolbar. |
| TextFitHeight | String | Nil | Localizable string to display in viewer toolbar. |
| TextFitPage | String | Nil | Localizable string to display in viewer toolbar. |
| TextFitWidth | String | Nil | Localizable string to display in viewer toolbar. |
| TextPrint | String | Nil | Localizable string to display in viewer toolbar. |
| TextRotateClockwise | String | Nil | Localizable string to display in viewer toolbar. |
| TextRotateCounter | String | Nil | Localizable string to display in viewer toolbar. |
| ToolbarVisible | Boolean | Nil | Controls visibility of the titlebar. |
| TooltipFirstPage | String | Nil | Localizable string to display in tooltip. |
| TooltipGoToPage | String | Nil | Localizable string to display in tooltip. |
| TooltipLastPage | String | Nil | Localizable string to display in tooltip. |
| TooltipNextPage | String | Nil | Localizable string to display in tooltip. |
| TooltipPreviousPage | String | Nil | Localizable string to display in tooltip. |
| TooltipToggleSidebar | String | Nil | Localizable string to display in tooltip. |
| TooltipZoomIn | String | Nil | Localizable string to display in tooltip. |
| TooltipZoomOut | String | Nil | Localizable string to display in tooltip. |