PDF Viewer (starting with version 1.5) implements the x-callback-url protocol, which allows iOS and Mac developers to expose and document the methods they make available to other apps and return useful data.

PDF Viewer URL Scheme actions look like this:

pdfviewer://x-callback-url/[action]?[action parameters]&[x-callback parameters]

Add to PDF Viewer

To send PDF files from Safari to PDF Viewer you can use this HTML snippet:

<a href="pdfviewer://x-callback-url/add-file?url=https://pspdfkit.com/downloads/case-study-box.pdf">Add to PDF Viewer</a>

Action: Add "Case Study" to PDF Viewer

The PDF will be automatically saved in PDF Viewer.

Actions

/open-file

Open the local file from the path.

Parameters:

  • path - required path to a file.

Example:

pdfviewer://x-callback-url/open-file?path=/Quick%20Start.pdf

/add-file

Store a file (or download from url) locally as filename.

  • url - URL address to a file.
  • data - base64 representation of a file. This parameter must be URL encoded.
  • filename - file name with extension. Both data and filename are required to successfully add a file.
  • open - optional. Open newly added file.

Examples:

pdfviewer://x-callback-url/add-file?open=true&url=https://pspdfkit.com/downloads/case-study-box.pdf
pdfviewer://x-callback-url/add-file?open=false&filename=Document.pdf&data=UERGIFZpZXdlciBQREYgVmlld2VyIFBERiBWaWV3ZXIgUERGIFZpZXdlci4uLgo%3D

/search

Open application and search files for a term.

  • term - optional string to search.

Example:

pdfviewer://x-callback-url/search?term=Start
Did this answer your question?