You can use the UMD Module as mentioned in their GitHub page. Here are some of the useful information I extracted from their GitHub page.

UMD Module

You can also download pdf-lib as a UMD module from unpkg or jsDelivr. The UMD builds have been compiled to ES5, so they should work in any modern browser. UMD builds are useful if you aren't using a package manager or module bundler. For example, you can use them directly in the tag of an HTML page.

The following builds are available:

  • https://unpkg.com/pdf-lib/dist/pdf-lib.js
  • https://unpkg.com/pdf-lib/dist/pdf-lib.min.js
  • https://cdn.jsdelivr.net/npm/pdf-lib/dist/pdf-lib.js
  • https://cdn.jsdelivr.net/npm/pdf-lib/dist/pdf-lib.min.js

NOTE: if you are using the CDN scripts in production, you should include a specific version number in the URL, for example:

  • https://unpkg.com/[email protected]/dist/pdf-lib.min.js
  • https://cdn.jsdelivr.net/npm/[email protected]/dist/pdf-lib.min.js

Example:

<html>
  <head>
    <meta charset="utf-8" />
    <script src="https://unpkg.com/pdf-lib"></script>
  </head>

  <body>
    <div style="display: flex; width: 100%; height: 100%; flex-direction: column; overflow: hidden;">
        <iframe id="pdf" style="flex-grow: 1; border: none; margin: 0; padding: 0;"></iframe>
    </div>
  </body>
  <script type="text/javascript" src="https://unpkg.com/[email protected]/dist/pdf-lib.min.js"></script>
  <script>
    createPdf();
    async function createPdf() {
      const pdfDoc = await PDFLib.PDFDocument.create();
      const page = pdfDoc.addPage([350, 400]);
      page.moveTo(110, 200);
      page.drawText('Hello World!');
      const pdfDataUri = await pdfDoc.saveAsBase64({ dataUri: true
     });
      document.getElementById('pdf').src = pdfDataUri;
    }
  </script>
</html>
Answer from Lakshitha Kanchana on Stack Overflow
🌐
cdnjs
cdnjs.com › home › libraries › pdf-lib
pdf-lib - Libraries - cdnjs - The #1 free and open source CDN built to make life easier for developers
Content delivery at its finest. cdnjs is a free and open-source CDN service trusted by over 12.5% of all websites, serving over 200 billion requests each month, powered by Cloudflare.
🌐
jsDelivr
jsdelivr.com › package › npm › pdf-lib
pdf-lib CDN by jsDelivr - A CDN for npm and GitHub
November 6, 2021 - A free, fast, and reliable CDN for pdf-lib. Create and modify PDF files with JavaScript
Published   Sep 04, 2017
🌐
jsDelivr
cdn.jsdelivr.net [email protected]
pdf-lib CDN by jsDelivr - A free, fast, and reliable Open Source CDN
pdf-lib CDN by jsDelivr - A free, fast, and reliable Open Source CDN for npm and GitHub
Top answer
1 of 1
2

You can use the UMD Module as mentioned in their GitHub page. Here are some of the useful information I extracted from their GitHub page.

UMD Module

You can also download pdf-lib as a UMD module from unpkg or jsDelivr. The UMD builds have been compiled to ES5, so they should work in any modern browser. UMD builds are useful if you aren't using a package manager or module bundler. For example, you can use them directly in the tag of an HTML page.

The following builds are available:

  • https://unpkg.com/pdf-lib/dist/pdf-lib.js
  • https://unpkg.com/pdf-lib/dist/pdf-lib.min.js
  • https://cdn.jsdelivr.net/npm/pdf-lib/dist/pdf-lib.js
  • https://cdn.jsdelivr.net/npm/pdf-lib/dist/pdf-lib.min.js

NOTE: if you are using the CDN scripts in production, you should include a specific version number in the URL, for example:

  • https://unpkg.com/[email protected]/dist/pdf-lib.min.js
  • https://cdn.jsdelivr.net/npm/[email protected]/dist/pdf-lib.min.js

Example:

<html>
  <head>
    <meta charset="utf-8" />
    <script src="https://unpkg.com/pdf-lib"></script>
  </head>

  <body>
    <div style="display: flex; width: 100%; height: 100%; flex-direction: column; overflow: hidden;">
        <iframe id="pdf" style="flex-grow: 1; border: none; margin: 0; padding: 0;"></iframe>
    </div>
  </body>
  <script type="text/javascript" src="https://unpkg.com/[email protected]/dist/pdf-lib.min.js"></script>
  <script>
    createPdf();
    async function createPdf() {
      const pdfDoc = await PDFLib.PDFDocument.create();
      const page = pdfDoc.addPage([350, 400]);
      page.moveTo(110, 200);
      page.drawText('Hello World!');
      const pdfDataUri = await pdfDoc.saveAsBase64({ dataUri: true
     });
      document.getElementById('pdf').src = pdfDataUri;
    }
  </script>
</html>
🌐
cdnjs
cdnjs.com › home › libraries › pdf.js › 2.6.347
pdf.js - Libraries - cdnjs - The #1 free and open source CDN built to make life easier for developers
https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.6.347/pdf.js.map · https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.6.347/pdf.min.js · https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.6.347/pdf.worker.entry.js · https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.6.347/pdf.worker.entry.min.js ·
🌐
GitHub
github.com › Hopding › pdf-lib
GitHub - Hopding/pdf-lib: Create and modify PDF documents in any JavaScript environment
See also How to Create and Modify PDF Files in Deno With pdf-lib · Below is the create document example modified for Deno: import { PDFDocument, StandardFonts, rgb, } from 'https://cdn.skypack.dev/pdf-lib@^1.11.1?dts'; const pdfDoc = await PDFDocument.create(); const timesRomanFont = await pdfDoc.embedFont(StandardFonts.TimesRoman); const page = pdfDoc.addPage(); const { width, height } = page.getSize(); const fontSize = 30; page.drawText('Creating PDFs in JavaScript is awesome!', { x: 50, y: height - 4 * fontSize, size: fontSize, font: timesRomanFont, color: rgb(0, 0.53, 0.71), }); const pdfBytes = await pdfDoc.save(); await Deno.writeFile('out.pdf', pdfBytes);
Starred by 8.1K users
Forked by 827 users
Languages   TypeScript 80.9% | HTML 9.9% | JavaScript 8.5% | Objective-C 0.3% | CSS 0.2% | Starlark 0.1% | Java 0.1%
🌐
jsDelivr
jsdelivr.com › package › npm › pdflib
pdflib CDN by jsDelivr - A CDN for npm and GitHub
August 3, 2015 - A free, fast, and reliable CDN for pdflib. Node bindings for pdflib
Published   Aug 03, 2015
Find elsewhere
🌐
GitHub
github.com › Hopding › pdf-lib › issues › 1386
How do I use rgb with cdn? · Issue #1386 · Hopding/pdf-lib
October 8, 2022 - using library as CDN · <script src="public/assets/pdf-lib-1.17.1/dist/pdf-lib.min.js"></script> 1.17.1 · Browser · My report includes a Short, Self Contained, Correct (Compilable) Example. I have attached all PDFs, images, and other files needed to run my SSCCE.
Published   Jan 23, 2023
🌐
jsDelivr
cdn.jsdelivr.net › @pdfme/[email protected]
@pdfme/pdf-lib CDN by jsDelivr - A free, fast, and reliable Open Source CDN
@pdfme/pdf-lib CDN by jsDelivr - A free, fast, and reliable Open Source CDN for npm and GitHub
🌐
jsDelivr
jsdelivr.com › package › npm › pdf-lib-extended
pdf-lib-extended CDN by jsDelivr - A CDN for npm and GitHub
August 21, 2024 - A free, fast, and reliable CDN for pdf-lib-extended. This project extends the capabilities of the pdf-lib JavaScript library by providing a set of helper functions that simplify common PDF manipulation tasks.
Published   Aug 21, 2024
🌐
CDNPKG
cdnpkg.com › home › pdf-lib
PDF-LIB CDN links - CDNPKG
1 CDN to use with PDF-LIB. Find out the best CDN to use with pdf-lib or use multiple CDN as fallback. Simply copy and paste one of these URL !.
🌐
jsDelivr
jsdelivr.com › package › npm › @pdf-lib › fontkit
pdf-lib/fontkit - A CDN for npm and GitHub
November 28, 2020 - A free, fast, and reliable CDN for @pdf-lib/fontkit. An advanced font engine for Node and the browser
Published   Dec 19, 2018
🌐
UNPKG
unpkg.com › browse › [email protected] › README.md
pdf-lib
All of the [usage examples](#usage-examples) work in Deno. The only thing you need to do is change the imports for `pdf-lib` and `@pdf-lib/fontkit` to use the [Skypack](https://www.skypack.dev/) CDN, because Deno requires all modules to be referenced via URLs.
🌐
jsDelivr
cdn.jsdelivr.net › @cantoo/[email protected]
@cantoo/pdf-lib CDN by jsDelivr - A free, fast, and reliable Open Source CDN
@cantoo/pdf-lib CDN by jsDelivr - A free, fast, and reliable Open Source CDN for npm and GitHub
🌐
jsDelivr
cdn.jsdelivr.net › @pdf-lib/[email protected]
@pdf-lib/fontkit CDN by jsDelivr - A free, fast, and reliable Open Source CDN
@pdf-lib/fontkit CDN by jsDelivr - A free, fast, and reliable Open Source CDN for npm and GitHub
🌐
Apache PDFBox
products.documentprocessing.com › editor › javascript › pdf-lib
pdf-lib | JavaScript PDF Editor | Create & Modify PDFs
June 25, 2025 - https://cdn.jsdelivr.net/npm/pdf-lib/dist/pdf-lib.min.js · We can utilize the pdf-lib library to create PDF document and add content to PDF. This includes the ability to customize the appearance of added text, such as font size, boldness, and various styling options.
🌐
npm
npmjs.com › package › pdf-lib
pdf-lib - npm
See also How to Create and Modify PDF Files in Deno With pdf-lib · Below is the create document example modified for Deno: import { PDFDocument, StandardFonts, rgb, } from 'https://cdn.skypack.dev/pdf-lib@^1.11.1?dts'; const pdfDoc = await PDFDocument.create(); const timesRomanFont = await pdfDoc.embedFont(StandardFonts.TimesRoman); const page = pdfDoc.addPage(); const { width, height } = page.getSize(); const fontSize = 30; page.drawText('Creating PDFs in JavaScript is awesome!', { x: 50, y: height - 4 * fontSize, size: fontSize, font: timesRomanFont, color: rgb(0, 0.53, 0.71), }); const pdfBytes = await pdfDoc.save(); await Deno.writeFile('out.pdf', pdfBytes);
      » npm install pdf-lib
    
Published   Nov 06, 2021
Version   1.17.1
Author   Andrew Dillon