Examples
Each page embeds the viewer with pdfviewer-embed.js. The PDF is written by the page itself
(sample-pdf.js), so nothing is downloaded but the viewer, and nothing is uploaded.
View the source of a page to copy its code.
Live examples
-
Full windowThe viewer fills the page, with the side panel. Add
?url=…to open another PDF of this site (other sites are refused). - Sized containerA fixed box in an article, with a full-screen button.
- In lineEvery page in the flow of the article; the article scrolls.
- Light boxThe viewer opens over the page and closes back to it.
- Events and APIsEvery event in a log, and buttons for each API.
-
File pickerOpen a PDF from your device with
content.promise. -
Annotations and savingThe annotation tools, the annotation manager (add, get, update, delete, XFDF), its events, and a
SAVE_APIcallback that offers the saved PDF as a download. - FormsFill an order form (text, check box, radio buttons, combo box, a calculated total) and save it.
-
Large filesA 46 MB document written by the page (
large-pdf.js), opened by ranges (linearizationInfo) or whole over a simulated network, with the time to the first page and the bytes read;?url=…uses real range requests.
Frameworks (copy into your app)
These files are not run here. Copy one into your app and change the script URL to where you serve the viewer.