🌐
PDF-LIB
pdf-lib.js.org
PDF-LIB · Create and modify PDF documents in any JavaScript environment.
import { PDFDocument } from 'pdf-lib' // PDF Creation const pdfDoc = await PDFDocument.create() const page = pdfDoc.addPage() page.drawText('You can create PDFs!') const pdfBytes = await pdfDoc.save() // PDF Modification const pdfDoc = await PDFDocument.load(...) const pages = pdfDoc.getPages() pages[0].drawText('You can modify PDFs too!') const pdfBytes = await pdfDoc.save() Create and modify PDF documents in any JavaScript environment.
API
Ƭ AppearanceMapping: object · Defined in api/form/appearances.ts:88
Help
Please take a look at our GitHub issues and see if your question has already been answered. If not, please create your own issue and we will respond as soon as possible!
🌐
npm
npmjs.com › package › pdf-lib
pdf-lib - npm
Create and modify PDF documents in any JavaScript environment. Designed to work in any modern JavaScript runtime. Tested in Node, Browser, Deno, and React Native environments. ... pdf-lib was created to address the JavaScript ecosystem's lack ...
      » npm install pdf-lib
    
Published   Nov 06, 2021
Version   1.17.1
Author   Andrew Dillon
🌐
PDFlib
pdflib.com › documentation
PDFlib: Documentation
PDFlib GmbH(Powered by Apryse, Producer of the Market's Leading PDF SDK)
🌐
PDF-LIB
pdf-lib.js.org › docs › api
pdf-lib · PDF-LIB
pdf-lib · BlendMode · ColorTypes · Duplex · ImageAlignment · LineCapStyle · LineJoinStyle · NonFullScreenPageMode · ParseSpeeds · PrintScaling · ReadingDirection · RotationTypes · StandardFonts · TextAlignment · TextRenderingMode · PDFButton · PDFCheckBox ·
🌐
PDF-LIB
pdf-lib.js.org › docs › api › classes › pdfdocument
PDFDocument · PDF-LIB
pdf-lib › PDFDocument · Represents a PDF document. PDFDocument · catalog · context · defaultWordBreaks · isEncrypted · addJavaScript · addPage · attach · copy · copyPages · embedFont · embedJpg · embedPage · embedPages · embedPdf ...
🌐
GitHub
github.com › Hopding › pdf-lib
GitHub - Hopding/pdf-lib: Create and modify PDF documents in any JavaScript environment
Create and modify PDF documents in any JavaScript environment. Designed to work in any modern JavaScript runtime. Tested in Node, Browser, Deno, and React Native environments. ... pdf-lib was created to address the JavaScript ecosystem's lack ...
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%
🌐
LogRocket
blog.logrocket.com › home › managing pdfs in node with pdf-lib
Managing PDFs in Node with pdf-lib - LogRocket Blog
June 4, 2024 - It adds a simple “hello world” text to the blank PDF document we created in the previous sub-section. Ordinarily, you add text using the drawText method. It takes up to two arguments. ... The first argument is the text you want to add, and the second argument is an object, which takes various properties you can look up in the pdf-lib documentation.
🌐
JSFiddle
jsfiddle.net › Hopding › 64zajhge › 1
Modify Document (pdf-lib) - JSFiddle - Code Playground
JSFiddle - Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle.
🌐
The Code Barbarian
thecodebarbarian.com › working-with-pdfs-in-node-js.html
Working With PDFs in Node.js Using pdf-lib | www.thecodebarbarian.com
The pdf-lib module gives you very fine grained control over PDFs, and is great for tasks like merging PDFs, adding page numbers and watermarks, splitting PDFs, and basically anything else you might use the ILovePDF API for.
Find elsewhere
🌐
Form.io
mindbowser.com › home › blogs › unlocking the potential of pdfs: a guide to pdf-lib.js
Unlocking the Potential of PDFs: A Guide to PDF-lib.js
July 10, 2023 - Discover PDF-lib.js, a versatile JavaScript library that empowers developers to create, modify, and manipulate PDF documents effortlessly.
🌐
PDFlib
pdflib.com › documentation › manuals
PDFlib: Manuals
All PDFlib GmbH distribution packages include English product documentation. Therefore you already have a manual on your local disk after unpacking or installing a package.
🌐
Honeybadger
honeybadger.io › blog › pdf-node
Managing PDFs in Node.js with pdf-lib - Honeybadger Developer Blog
November 16, 2023 - The PDFDocument class is the cornerstone of pdf-lib, allowing you to create, modify, and manipulate PDF documents. The rgb function helps you define colors in the Red-Green-Blue (RGB) format, which is commonly used for specifying colors in PDFs.
🌐
GitHub
github.com › rivy › js.pdf-lib
GitHub - rivy/js.pdf-lib: Create and modify PDF documents in any JavaScript environment
Create and modify PDF documents in any JavaScript environment. Designed to work in any modern JavaScript runtime. Tested in Node, Browser, and React Native environments. ... pdf-lib was created to address the JavaScript ecosystem's lack of robust ...
Author   rivy
🌐
GitHub
github.com › Hopding › pdf-lib › blob › master › docs › CONTRIBUTING.md
pdf-lib/docs/CONTRIBUTING.md at master · Hopding/pdf-lib
pdf-lib is a JavaScript library designed to create and modify PDF files in any JavaScript environment. Contributions are welcomed and appreciated! Please read through this document to learn how to setup and run the project on your machine.
Author   Hopding
🌐
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
Create and modify PDF files with JavaScript - Simple. Fast. Reliable. 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. We make it faster and easier to load library files on your websites.
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>
🌐
PDFlib
pdflib.com › products › pdflib-family › overview
PDFlib: What is PDFlib?
PDFlib is a well-established developer component for generating and manipulating PDF documents. PDFlib’s main targets are dynamic PDF creation on a Web server and PDF creation in any kind of server, desktop or mobile application.
🌐
Nutrient
nutrient.io › blog › sdk › how to build a javascript pdf editor
JavaScript PDF editor tutorial using pdf‑lib
November 4, 2024 - pdf-lib(opens in a new tab) is a versatile JavaScript library for creating and modifying PDF documents in any JavaScript environment, including browsers, Node.js, Deno, and React Native.
🌐
HayaGeek
hayageek.com › home › pdf-lib tutorial – generate pdf in node.js
Pdf-lib tutorial - Generate PDF in Node.js
November 29, 2023 - Master document manipulation with our Pdf-lib tutorial - your ultimate guide to using the npm package pdf-lib for creating and editing PDFs.
🌐
GitHub
github.com › Hopding › pdf-lib › blob › master › docs › MIGRATION.md
pdf-lib/docs/MIGRATION.md at master · Hopding/pdf-lib
Create and modify PDF documents in any JavaScript environment - Hopding/pdf-lib
Author   Hopding