# Xojo-VNS-PDFJS-WebViewer: A xojo websdk to display pdf using mozilla pdf.js

**URL:** <https://forum.xojo.com/t/xojo-vns-pdfjs-webviewer-a-xojo-websdk-to-display-pdf-using-mozilla-pdf-js/88962>\
**Category:** Web SDK\
**Created:** [October 5, 2026, 9:10am UTC](https://forum.xojo.com/t/xojo-vns-pdfjs-webviewer-a-xojo-websdk-to-display-pdf-using-mozilla-pdf-js/88962 "2026-10-05T09:10:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jean-Yves\_Pochez](https://forum.xojo.com/user_avatar/forum.xojo.com/jean-yves_pochez/32/21769_2.png) [@Jean-Yves\_Pochez](https://forum.xojo.com/u/Jean-Yves_Pochez)\
**Post date:** [October 5, 2026, 9:10am UTC](https://forum.xojo.com/t/xojo-vns-pdfjs-webviewer-a-xojo-websdk-to-display-pdf-using-mozilla-pdf-js/88962/1 "2026-10-05T09:10:31Z")

</div>

Hi everyone,

I’m releasing a free, open-source **Xojo Web 2.0 control that displays PDF files** with **Mozilla PDF.js** – the viewer built into Firefox. Drop it on a web page, set its properties in the Inspector, call `LoadFromFile`. No JavaScript to write, no Node.js, no build step: PDF.js ships inside the control.

> **[GitHub - JYPochez/Xojo-VNS-PDFJS-WebViewer: A xojo websdk to display pdf using mozilla pdf.js](https://github.com/JYPochez/Xojo-VNS-PDFJS-WebViewer)**
>
> A xojo websdk to display pdf using mozilla pdf.js

 ![demo-viewer](https://forum.xojo.com/uploads/default/original/3X/d/4/d4b75e3f931a667b65f9e3a39921d7ade16ecd61.jpeg)

## The same PDF display in every browser

Show a PDF in a `WebHTMLViewer` or through a link, and each browser uses its own viewer: Chrome and Edge one, Safari another, Firefox a third – each with its own toolbar, features and quirks, and some mobile browsers can’t show a PDF inside a page at all. With this control **every browser displays the PDF with the same viewer** : same look, same toolbar, same features, and the same settings you chose in Xojo.

## Two files and one line

1. Add `VNSPDFJSWebViewer.xojo_code` and `VNSPDFJSEmbedded.xojo_code` to your project
2. In `App.HandleURL`:

```xojo
If VNSPDFJSWebViewer.HandleLibraryRequest(request, response) Then Return True

```

1. Drag a `VNSPDFJSWebViewer` onto a web page

```xojo
PDFViewerMain.LoadFromFile(SpecialFolder.Documents.Child("report.pdf"))
PDFViewerMain.LoadFromData(pdfData, "invoice-2026-001.pdf") // from VNS fPDF, a database, an upload...
PDFViewerMain.LoadFromURL("https://example.com/manual.pdf")

```

## The full Firefox viewer

- Thumbnails, outline (bookmarks), attachments and layers sidebar
- Text search, zoom, rotation, scroll and two-page spread modes, presentation mode
- Printing, download, **fillable forms** , text selection
- **CJK and right-to-left** text, embedded fonts, JBIG2 / JPEG 2000 images
- Light, dark or automatic theme, 100+ interface languages

## Set it up in the Inspector

 ![inspector-properties](https://forum.xojo.com/uploads/default/original/3X/8/c/8cf72e42c1b299c3305bdf039b87477c3e2ad67e.png)

- **22 properties** in four groups: Document, Appearance, Permissions, Advanced
- First page, zoom mode, rotation, scroll/spread mode, sidebar, cursor tool, theme, language, toolbar
- **Permissions** : hide/disable print, download, open file, presentation mode, annotation editing, text selection; PDF JavaScript off by default
- Change them at run time too

## Drive it from Xojo

- `GoToPage`, `FirstPage`, `LastPage`, `NextPage`, `PreviousPage`, `ZoomIn`, `ZoomOut`, `Rotate...`, `Print`, `Download`, `Find`, `FindNext`, `FindPrevious`
- Events: `DocumentLoaded(pageCount, title)`, `PageChanged`, `ZoomChanged`, `RotationChanged`, `FindResult(currentMatch, totalMatches)`, `LoadFailed`
- Documents are served by the control itself, only to the session that shows them

## Embedded, folder or CDN

- **Embedded** (default): PDF.js compressed into one module, works offline, nothing to deploy
- **Resources folder** : the `pdfjs` folder copied next to the app by a build step
- **CDN** : the heavy engine from jsDelivr, the viewer UI from your app

A demo project is included (upload, URL, navigation, zoom, search), plus a developer guide with the full API and how it works inside.

It pairs nicely with **VNS fPDF** ([GitHub - JYPochez/Xojo-VNS-fpdf-Library: A Xojo port of the popular FPDF library for PDF generation, supporting Desktop, Web, iOS, and Console applications. · GitHub](https://github.com/JYPochez/Xojo-VNS-fpdf-Library)): generate the PDF with fPDF, show it with `LoadFromData` – no temporary file.

Questions, feedback or bug reports? Post in this thread or open an issue on GitHub!

_VNS PDF.js Web Viewer 1.0 - Xojo Web 2.0 - PDF.js 6.4.299 - MIT license_  
_Tested with Xojo 2026r2.1 on macOS – needs Xojo 2024r3 or later_
