PDF location and initial view parameters
The query is ?file=...&config=catalog.json; the fragment is #page=2&zoom=150. Encode the complete file value through rawurlencode(), http_build_query() or URLSearchParams, particularly for spaces, non-ASCII names and PDF URLs containing their own ? and &. Escape the final URL in HTML.
| Parameter | Example | Purpose |
|---|---|---|
file | /images/documents/catalog.pdf | Query: PDF sharing the viewer origin. |
config | catalog.json | Query: user JSON filename. |
page | 2 | Fragment: page number, starting at 1. |
zoom | 150, page-width, page-fit, auto | Fragment: zoom percentage or mode. |
pagemode | thumbs, bookmarks, attachments, layers, none | Fragment: sidebar mode. |
The complete viewer requires matching PDF and viewer origins: scheme, hostname and port. It rejects remote file URLs even when CORS permits access. Host the PDF on your site or use your own server endpoint with access checks. Direct getDocument() use can load remote PDFs with suitable CORS. JSON is also fetched from the viewer origin.