GraffitiPDFViewer

View Categories

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
  • Print
  • Text Selection
  • Annotation Display
  • Embedded External Links
  • Page to Image
  • Page to Text

Enumerations #

NameValues
DisplayModesVertical
Horizontal

Constants #

This class exposes no constants.

Events #

DefinitionParametersReturn TypeDescription
ErrorCode as IntegerNoneRaised when the viewer has encountered an exception. See table of possible errors below.
name as String
message as String
FileDroppedname as String
content as String
BooleanA file has been dropped on the control. Return True to cancel default loading.
PageChangedNoneNoneRaised when the user has navigated to a different page.
RenderedNoneNoneRaised when a PDF document is successfully loaded.
SavePressedNoneNoneRaised 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.
ZoomChangedNoneNoneRaised when the user has changed the zoom level.

Methods #

DefinitionParametersReturn TypeDescription
CloseDocumentNoneNoneCloses the currently viewed document.
Findtext as StringNoneFinds and highlights the supplied text instances in the viewer.
FitHeightNoneNoneFits the zoom level to show the current page’s full height.
FitPageNoneNoneFits the zoom level to show the current page in its entirety.
FitWidthNoneNoneFits the zoom level to show current page’s full width.
OpenDocumentf as FolderItemNoneOpens the specified document.
password as String = “”
OpenDocumenturl as StringNoneOpens the specified document.
password as String = “”
PageContentAtindex as IntegerStringReturns the text content of the specified page.
PageImageindex as IntegerPictureReturns an image of the specified page.
PageIndexNoneIntegerThe current page index.
PageLastIndexNoneIntegerIndex of the last page in the document.
PrintshowDialog as Boolean = TrueNonePrints the current document.
Rotatevalue as DoubleNoneRotates the document. value represents degrees of rotation.
SaveDocumentf as FolderItemNoneSaves the currently loaded document to the specified path.
ScrollToPageindex as IntegerNoneScrolls the viewer to show the specified page.
ZoomNoneDoubleReturns the current zoom level.
ZoomAssigns value as DoubleNoneSets the current zoom level.
ZoomInNoneNoneZooms in by 25%.
ZoomOutNoneNoneZooms out by 25%.

Properties #

NameTypeDefault ValueDescription
DisplayModeDisplayModesDisplayModes.VerticalThe current page display orientation.
FileDropAllowedBooleanTrueDetermines whether users are allowed to drop files on the viewer to load them.
FileDropCaptionString“Drop file to open.”Text displayed in file drop overlay.
FileDropCaptionWorkingString“Loading file…”Text displayed while the control attempts to load the dropped file.
SidebarVisibleBooleanTrueDetermines whether the thumbnail sidebar is visible.
TextDisplayHorizontalString“Horizontal”Localizable string to display in viewer toolbar.
TextDisplayVerticalString“Vertical”Localizable string to display in viewer toolbar.
TextDownloadString“Save”Localizable string to display in viewer toolbar.
TextFitHeightString“Fit Height”Localizable string to display in viewer toolbar.
TextFitPageString“Fit Page”Localizable string to display in viewer toolbar.
TextFitWidthString“Fit Width”Localizable string to display in viewer toolbar.
TextPrintString“Print”Localizable string to display in viewer toolbar.
TextRotateCounterString“-90°”Localizable string to display in viewer toolbar.
TextRotateClockwiseString“90°”Localizable string to display in viewer toolbar.
TooltipToggleSidebarString“Toggle Thumbnails”Localizable string to display in tooltip.
TooltipFirstPageString“First Page”Localizable string to display in tooltip.
TooltipPreviousPageString“Previous Page”Localizable string to display in tooltip.
TooltipNextPageString“Next Page”Localizable string to display in tooltip.
TooltipLastPageString“Last Page”Localizable string to display in tooltip.
TooltipGoToPageString“Go to Page”Localizable string to display in tooltip.
TooltipZoomInString“Zoom In”Localizable string to display in tooltip.
TooltipZoomOutString“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