Images #
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
- Text Selection
- Annotation Display
- Embedded External Links
- Page to Image
- Page to Text
Requirements #
This class is not supported on Linux due to limitations in Xojo.Enumerations #
Name | Values |
---|---|
DisplayModes | Vertical |
Horizontal |
Constants #
This class exposes no constants.
Events #
Definition | Parameters | Return Type | Description |
---|---|---|---|
Error | Code as Integer | None | Raised when the viewer has encountered an exception. See table of possible errors below. |
name as String | |||
message as String | |||
FileDropped | name as String content as String | Boolean | A file has been dropped on the control. Return True to cancel default loading. |
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 #
Definition | Parameters | Return Type | Description |
---|---|---|---|
CloseDocument | None | None | Closes the currently viewed document. |
Find | text as String | None | Finds and highlights the supplied text instances in the viewer. |
FitHeight | None | None | Fits the zoom level to show the current page’s full height. |
FitPage | None | None | Fits the zoom level to show the current page in its entirety. |
FitWidth | None | None | Fits the zoom level to show current page’s full width. |
OpenDocument | f as FolderItem | None | Opens the specified document. |
password as String = “” | |||
OpenDocument | url as String | None | Opens the specified document. |
password as String = “” | |||
PageContentAt | index as Integer | String | Returns the text content of the specified page. |
PageImage | index as Integer | Picture | Returns an image of the specified page. |
PageIndex | None | Integer | The current page index. |
PageLastIndex | None | Integer | Index of the last page in the document. |
showDialog as Boolean = True | None | Prints the current document. | |
Rotate | value as Double | None | Rotates the document. value represents degrees of rotation. |
SaveDocument | f as FolderItem | None | Saves the currently loaded document to the specified path. |
ScrollToPage | index as Integer | None | Scrolls the viewer to show the specified page. |
Zoom | None | Double | Returns the current zoom level. |
Zoom | Assigns value as Double | None | Sets the current zoom level. |
ZoomIn | None | None | Zooms in by 25%. |
ZoomOut | None | None | Zooms out by 25%. |
Properties #
Name | Type | Default Value | Description |
---|---|---|---|
DisplayMode | DisplayModes | DisplayModes.Vertical | The current page display orientation. |
FileDropAllowed | Boolean | True | Determines whether users are allowed to drop files on the viewer to load them. |
FileDropCaption | String | “Drop file to open.” | Text displayed in file drop overlay. |
FileDropCaptionWorking | String | “Loading file…” | Text displayed while the control attempts to load the dropped file. |
SidebarVisible | Boolean | True | Determines whether the thumbnail sidebar is visible. |
TextDisplayHorizontal | String | “Horizontal” | Localizable string to display in viewer toolbar. |
TextDisplayVertical | String | “Vertical” | Localizable string to display in viewer toolbar. |
TextDownload | String | “Save” | Localizable string to display in viewer toolbar. |
TextFitHeight | String | “Fit Height” | Localizable string to display in viewer toolbar. |
TextFitPage | String | “Fit Page” | Localizable string to display in viewer toolbar. |
TextFitWidth | String | “Fit Width” | Localizable string to display in viewer toolbar. |
TextPrint | String | “Print” | Localizable string to display in viewer toolbar. |
TextRotateCounter | String | “-90°” | Localizable string to display in viewer toolbar. |
TextRotateClockwise | String | “90°” | Localizable string to display in viewer toolbar. |
TooltipToggleSidebar | String | “Toggle Thumbnails” | Localizable string to display in tooltip. |
TooltipFirstPage | String | “First Page” | Localizable string to display in tooltip. |
TooltipPreviousPage | String | “Previous Page” | Localizable string to display in tooltip. |
TooltipNextPage | String | “Next Page” | Localizable string to display in tooltip. |
TooltipLastPage | String | “Last Page” | Localizable string to display in tooltip. |
TooltipGoToPage | String | “Go to Page” | Localizable string to display in tooltip. |
TooltipZoomIn | String | “Zoom In” | Localizable string to display in tooltip. |
TooltipZoomOut | String | “Zoom Out” | Localizable string to display in tooltip. |
Examples #
This class currently has no examples.
Notes #
Potential Errors #
Codes may have no discernable meaning in some scenarios. Generally a code of 0
means that an error occurred in the Xojo code or the JavaScript exception code could not be determined. Names and messages will be far more useful in most circumstances.
Expected Exception Names |
---|
AbortException |
MissingPDFException |
PasswordException |
UnexpectedResponseException |
UnknownErrorException |
UnknownException |