🌐
PDF.js Express
pdfjs.express
PDF.js Viewer: Annotate, Form Fill | Easy Setup | PDF.js Express
Fast & easy PDF.js Viewer integration with PDF.js Express. Add annotations, fill forms & sign PDFs in a web browser. Fully supported - download & try it free
🌐
GitHub
github.com β€Ί pdfjs-express β€Ί pdfjs-express-typescript-sample
GitHub - pdfjs-express/pdfjs-express-typescript-sample
PDF.js Express is a powerful JavaScript-based PDF Library that leverages PDF.js and adds additional features such as annotations, form support, and digitial signatures.
Author Β  pdfjs-express
Discussions

java - Upgrading from PDF.js to PDF.js Express - Stack Overflow
I'm working on Struts 1 project, which has previously implemented PDF.js for previewing documents. Because of the the PDF.js library didn't support watermarks option, I decided to move to PDF.js Ex... More on stackoverflow.com
🌐 stackoverflow.com
Advice on community license of PDF.js Express Viewer
Hi Express team, I have plan to use the Viewer in my product by placing its inside an iframe similar to the PDF.js viewer are doing, am I eligible to deliver the viewer to users (on different domains) within the iframe , according to the single-domain license? More on pdfjs.community
🌐 pdfjs.community
0
October 23, 2024
Show HN: Pdf.js Express – PDF annotation, e-signatures, and form filling
Nick here. We're super excited to officially launch PDF.js Express [1] Β· PDF.js Express wraps a modern React UI around the PDF.js rendering engine to enable PDF annotation, form filling, and signing inside your web app. We've also made some improvements to PDF.js text search, and taken a different ... More on news.ycombinator.com
🌐 news.ycombinator.com
132
334
January 17, 2020
Display Pdf in browser using express js
Clone node-cheat pdf_browser, run node app followed by npm install express. Happy Helping! ... According to Express js documentation you can set the Content Type and the Content Disposition all in one function as shown below More on stackoverflow.com
🌐 stackoverflow.com
🌐
npm
npmjs.com β€Ί package β€Ί @pdftron β€Ί pdfjs-express-viewer
@pdftron/pdfjs-express-viewer - npm
July 4, 2024 - PDFJS Express is a powerful JavaScript-based PDF Library that wraps PDF.js.
      Β» npm install @pdftron/pdfjs-express-viewer
    
Published Β  Jul 04, 2024
Version Β  8.7.5
Author Β  PDFTron
Homepage Β  https://pdfjs.express
🌐
PDF Association
pdfa.org β€Ί building-pdf-js-express
Building PDF.js Express – PDF Association
Announcing PDF.js Express, a commercial viewer that wraps a modern React UI around the PDF.js rendering engine to enable PDF annotations, form filling, and signing inside a web app.
🌐
CodeSandbox
codesandbox.io β€Ί examples β€Ί package β€Ί @pdftron β€Ί pdfjs-express
@pdftron/pdfjs-express examples - CodeSandbox
About[PDFJS Express](https://pdfjs.express) is a powerful JavaScript-based PDF Library that wraps [PDF.js](https://mozilla.github.io/pdf.js/).
🌐
GitHub
github.com β€Ί pdfjs-express
PDF.js Express Β· GitHub
PDF.js Express has 25 repositories available. Follow their code on GitHub.
🌐
Nutrient
nutrient.io β€Ί blog β€Ί sdk β€Ί how to build an expressjs pdf viewer
How to build an Express.js PDF viewer
March 20, 2023 - The guide provides step-by-step instructions for setting up an Express server, creating routes to serve PDF files, integrating Mozilla’s PDF.js library for client-side rendering, and implementing proxy routes for proper file serving in a Node.js web application.
Find elsewhere
🌐
Stack Overflow
stackoverflow.com β€Ί questions β€Ί 77286548 β€Ί upgrading-from-pdf-js-to-pdf-js-express
java - Upgrading from PDF.js to PDF.js Express - Stack Overflow
I'm working on Struts 1 project, which has previously implemented PDF.js for previewing documents. Because of the the PDF.js library didn't support watermarks option, I decided to move to PDF.js Express.
🌐
PDF.js Express
pdfjs.community β€Ί general discussion
Advice on community license of PDF.js Express Viewer - General Discussion - PDF.js Express
October 23, 2024 - Hi Express team, I have plan to use the Viewer in my product by placing its inside an iframe similar to the PDF.js viewer are doing, am I eligible to deliver the viewer to users (on different domains) within the iframe , according to the single-domain license?
🌐
Hacker News
news.ycombinator.com β€Ί item
Show HN: Pdf.js Express – PDF annotation, e-signatures, and form filling | Hacker News
January 17, 2020 - We're super excited to officially launch PDF.js Express [1] Β· PDF.js Express wraps a modern React UI around the PDF.js rendering engine to enable PDF annotation, form filling, and signing inside your web app. We've also made some improvements to PDF.js text search, and taken a different ...
🌐
PDF.js Express
pdfjs.community
PDF.js Express - A support community for PDF.js Express
A support community focused on PDF.js, an open sourced browser based PDF library
Top answer
1 of 7
43

Specifying how a file download is handled all comes down to the Content-disposition header. You can also specify the name of the file here as well. We also set the Content-type to ensure the browser knows what to do with the file given to it.

Express.js Example:

app.post('/url/to/hit', function(req, res, next) {
  var stream = fs.createReadStream('/location/of/pdf');
  var filename = "WhateverFilenameYouWant.pdf"; 
  // Be careful of special characters

  filename = encodeURIComponent(filename);
  // Ideally this should strip them

  res.setHeader('Content-disposition', 'inline; filename="' + filename + '"');
  res.setHeader('Content-type', 'application/pdf');

  stream.pipe(res);
});

Now if you look more closely at the Content-disposition, you'll notice the inline; field is what sets how the browser reacts to the file. If you want to force downloads, you can do so by setting inline; to attachment;

I've also found out (by being burnt a couple times), that if you set special characters in your filename, it can break. So I encodeURIComponent() the filename to ensure that doesn't happen.

Hope that helps others trying to figure out the same!

Edit

In the time between me posting this originally and now, I've found out how to correctly encode the content-disposition's filename parameter. According to the spec, the filename should be RFC5987 encoded. I ended up finding an example code snippet from MDN that correctly handles the encoding here (encodeURIComponent() isn't the entirely correct format for this field).

MDN Snippet

var fileName = 'my file(2).txt';
var header = "Content-Disposition: attachment; filename*=UTF-8''" 
             + encodeRFC5987ValueChars(fileName);

console.log(header); 
// logs "Content-Disposition: attachment; filename*=UTF-8''my%20file%282%29.txt"

function encodeRFC5987ValueChars (str) {
    return encodeURIComponent(str).
        // Note that although RFC3986 reserves "!", RFC5987 does not,
        // so we do not need to escape it
        replace(/['()]/g, escape). // i.e., %27 %28 %29
        replace(/\*/g, '%2A').
            // The following are not required for percent-encoding per RFC5987, 
            // so we can allow for a little better readability over the wire: |`^
            replace(/%(?:7C|60|5E)/g, unescape);
}

Another note on top of this one, browsers don't fully comply with the spec either. Some characters will still come back incorrectly from a download (at least when I tested it).

You can get around this problem by updating how your downloads work. If your download URL ends with the filename (and you don't supply a filename attribute in the header), it will correctly get the filename from the URL encoded value. IE 'http://subdomain.domain-url.com/some/path/to/downloads/' + encodeURIComponent("You're there, download this!.pdf")

Jeeze, and all to supply a file name to your downloads!

2 of 7
14

My Solution for sending a PDF directly to the Browser:

app.get('/my/pdf', function (req, res) {
    var doc = new Pdf();
    doc.text("Hello World", 50, 50);

    doc.output( function(pdf) {
        res.type('application/pdf');
        res.end(pdf, 'binary');
    });
});

res.end() with the second param 'binary' did the trick in my case. Otherwise express interpret it as a string

🌐
Apryse
apryse.com β€Ί blog β€Ί how-to-use-pdf-js
PDF.js Viewer | Apryse
May 8, 2020 - As you can see, building a basic PDF viewer with PDF.js is pretty straightforward. If you require additional capabilities, like PDF annotation, filling forms, or e-signatures, consider PDF.js Express, which provides a PDF.js-based viewer with out-of-the-box annotation, PDF form fill, and signing.
🌐
e2m.live
spotsaas.com β€Ί product β€Ί pdf-js-express
PDF.js Express - Reviews, Features, Pricing & More (2025)
Explore top business software for 2025. With 5M+ real reviews, we provide data-driven insights and expert guidance to help your team decide smarter.
🌐
Nutrient
nutrient.io β€Ί sdk β€Ί vs β€Ί pdfjs express
Best PDF.js Express alternative: PDF.js Express vs. Nutrient [PSPDFKit] | Nutrient
Nutrient offers frequent updates, full document and data control, and broad file type support for modern web apps. PDF.js Express restricts basic PDF features and charges for upgrades.
🌐
OutSystems
outsystems.com β€Ί forge β€Ί component-overview β€Ί 15054 β€Ί pdf-js-express-viewer-o11
PDF JS Express Viewer - Overview (O11) | OutSystems
April 26, 2023 - OutSystems Implementation for https://pdfjs.express Add a PDF.js viewer to any application with out-of-the-box annotations, PDF form filling, and signing.
🌐
PDF.js Express
pdfjs.community β€Ί faq
What is PDF.js Express? - FAQ - PDF.js Express
May 22, 2020 - PDF.js Express is a client side PDF Viewing library, wrapping the open source library PDF.js. It adds additional functionality to PDF.js, such as annotations, form filling, a fully open sourced, customizable UI, and eSignatures.
🌐
Mozilla
mozilla.github.io β€Ί pdf.js
PDF.js - Home
A general-purpose, web standards-based platform for parsing and rendering PDFs.
🌐
SaaSworthy
saasworthy.com β€Ί home β€Ί new saas software β€Ί pdf.js express
PDF.js Express - Features & Pricing (December 2025)
1 day ago - PDF.js Express is an open source commercial PDF viewer for developers, allowing them to add e-signatures, annotations and forms within their PDF viewer. The software is equipped with three essential components, UI, webviewer.js and the core.