{"bugs":{"url":"https://github.com/Hopding/pdf-lib/issues"},"dist":{"shasum":"6cff9de04493e76981261b8c2f04ca9f5c0941b7","tarball":"https://registry.npmjs.org/pdf-lib/-/pdf-lib-1.6.1-rc1.tgz","fileCount":1119,"integrity":"sha512-4QuNqNzeDPKJ8+yLBu17aBTPDEkrpgL5I0EUJk4TQJa7LNB4U2gNjTlgaHW+uNE/ZbeDmroX5PQIhx+1fxdszA==","signatures":[{"sig":"MEYCIQC9xizQ8WFr/p7yz+Kjf6S340fiGgHIYMmopH7gbsrwJwIhAM536zcHFeF1ayY3y6Sxl/S0sPx6jOfGBqtOgL0v76q8","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":13841563,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeyqvDCRA9TVsSAnZWagAA/+EP+wcU3yNBT2Q7Nbdc8q7Y\nYhSVGjA2S/lb0Gbe/Rbbzq6y8FwsOyvCi+mrD4wjR4j0BY5WEzMSmSOn5j98\nMWXJgfZF/rIzVjRPrRX36lg/+7tvrcUuv0FdpV9rSlDZJrkZjPA8cjpuh8I8\nzNMDiNpFmJ8GbeXSElHUOL6Tgut20Ofur4Jz4GfkLLnf62mXxW+xC+GWsn8l\n/RUb4v3AkrKpSlMojlZl7sYh84gKJI9dfrp1R61Oh6c/NWCkMpI4dwS1Af2J\ng16heFZcIEomEkGveep66OeUWA9aPza/JvPt8tvhAiEvXYvaX4020LYxYWE6\n/1Jyd2U36/rulsTRdJksdJMmJlj/RNxXPbUxmw41SnbvPtuWWpGBwDhidlNA\nmM9Bfr6PX2UC2I6MZQsGNm0qdGk8PzhsRH8xRLjmXODsVxztraGGJxBxTJiK\nSIQI7unJ/YFyXna9qzAUeZJCqYeMd9f9dNIxbWPvpKTdlOmt3iJXbzbSC4UX\nj66BaXHDSe4Vm6ouZPvcOavOw+tMfov8wlfx7OWB9h0g6HhMd9pUU43F8iXv\nGNEF6ydJthBzGb313lFqdw+Z4AEzqQWlnVZjpaOgXwbfwoxWRda95fNnNbBq\nvznV4aSCYXS8L7j5et7GO3JUhxngRPW/TbE5jEqTQJGHwpcYMuY4rKh+0+xM\n0/M0\r\n=lShf\r\n-----END PGP SIGNATURE-----\r\n"},"main":"cjs/index.js","name":"pdf-lib","types":"cjs/index.d.ts","unpkg":"dist/pdf-lib.min.js","author":{"name":"Andrew Dillon","email":"andrew.dillon.j@gmail.com"},"module":"es/index.js","readme":"<a href=\"https://pdf-lib.js.org\">\n<h1 align=\"center\">\n<img alt=\"pdf-lib\" height=\"300\" src=\"https://raw.githubusercontent.com/Hopding/pdf-lib-docs/master/assets/logo-full.svg?sanitize=true\">\n</h1>\n</a>\n\n<div align=\"center\">\n  <strong>Create and modify PDF documents in any JavaScript environment.</strong>\n</div>\n<div align=\"center\">\n  Designed to work in any modern JavaScript runtime. Tested in Node, Browser, Deno, and React Native environments.\n</div>\n\n<br />\n\n<div align=\"center\">\n  <!-- NPM Version -->\n  <a href=\"https://www.npmjs.com/package/pdf-lib\">\n    <img\n      src=\"https://img.shields.io/npm/v/pdf-lib.svg?style=flat-square\"\n      alt=\"NPM Version\"\n    />\n  </a>\n  <!-- Build Status -->\n  <a href=\"https://circleci.com/gh/Hopding/pdf-lib\">\n    <img\n      src=\"https://img.shields.io/circleci/project/github/Hopding/pdf-lib/master.svg?style=flat-square&label=CircleCI\"\n      alt=\"CircleCI Build Status\"\n    />\n  </a>\n  <!-- Prettier Badge -->\n  <a href=\"https://prettier.io/\">\n    <img\n      src=\"https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square\"\n      alt=\"Prettier Badge\"\n    />\n  </a>\n</div>\n\n<br />\n\n> **Learn more at [pdf-lib.js.org](https://pdf-lib.js.org)**\n\n## Table of Contents\n\n- [Features](#features)\n- [Motivation](#motivation)\n- [Usage Examples](#usage-examples)\n  - [Create Document](#create-document)\n  - [Modify Document](#modify-document)\n  - [Copy Pages](#copy-pages)\n  - [Embed PNG and JPEG Images](#embed-png-and-jpeg-images)\n  - [Embed PDF Pages](#embed-pdf-pages)\n  - [Embed Font and Measure Text](#embed-font-and-measure-text)\n  - [Set Document Metadata](#set-document-metadata)\n  - [Read Document Metadata](#read-document-metadata)\n  - [Draw SVG Paths](#draw-svg-paths)\n- [Deno Usage](#deno-usage)\n- [Complete Examples](#complete-examples)\n- [Installation](#installation)\n- [Documentation](#documentation)\n- [Encryption Handling](#encryption-handling)\n- [Migrating to v1.0.0](#migrating-to-v1)\n- [Contributing](#contributing)\n- [Tutorials and Cool Stuff](#tutorials-and-cool-stuff)\n- [Prior Art](#prior-art)\n- [License](#license)\n\n## Features\n\n- Create new PDFs\n- Modify existing PDFs\n- Add Pages\n- Insert Pages\n- Remove Pages\n- Copy pages between PDFs\n- Draw Text\n- Draw Images\n- Draw PDF Pages\n- Draw Vector Graphics\n- Draw SVG Paths\n- Measure width and height of text\n- Embed Fonts (supports UTF-8 and UTF-16 character sets)\n- Set document metadata\n- Read document metadata\n\n## Motivation\n\n`pdf-lib` was created to address the JavaScript ecosystem's lack of robust support for PDF manipulation (especially for PDF _modification_).\n\nTwo of `pdf-lib`'s distinguishing features are:\n\n1. Supporting modification (editing) of existing documents.\n2. Working in all JavaScript environments - not just in Node or the Browser.\n\nThere are [other](#prior-art) good open source JavaScript PDF libraries available. However, most of them can only _create_ documents, they cannot _modify_ existing ones. And many of them only work in particular environments.\n\n## Usage Examples\n\n### Create Document\n\n_This example produces [this PDF](assets/pdfs/examples/create_document.pdf)._\n\n[Try the JSFiddle demo](https://jsfiddle.net/Hopding/rxwsc8f5/13/)\n\n<!-- prettier-ignore -->\n```js\nimport { PDFDocument, StandardFonts, rgb } from 'pdf-lib'\n\n// Create a new PDFDocument\nconst pdfDoc = await PDFDocument.create()\n\n// Embed the Times Roman font\nconst timesRomanFont = await pdfDoc.embedFont(StandardFonts.TimesRoman)\n\n// Add a blank page to the document\nconst page = pdfDoc.addPage()\n\n// Get the width and height of the page\nconst { width, height } = page.getSize()\n\n// Draw a string of text toward the top of the page\nconst fontSize = 30\npage.drawText('Creating PDFs in JavaScript is awesome!', {\n  x: 50,\n  y: height - 4 * fontSize,\n  size: fontSize,\n  font: timesRomanFont,\n  color: rgb(0, 0.53, 0.71),\n})\n\n// Serialize the PDFDocument to bytes (a Uint8Array)\nconst pdfBytes = await pdfDoc.save()\n\n// For example, `pdfBytes` can be:\n//   • Written to a file in Node\n//   • Downloaded from the browser\n//   • Rendered in an <iframe>\n```\n\n### Modify Document\n\n_This example produces [this PDF](assets/pdfs/examples/modify_document.pdf)_ (when [this PDF](assets/pdfs/with_update_sections.pdf) is used for the `existingPdfBytes` variable).\n\n[Try the JSFiddle demo](https://jsfiddle.net/Hopding/64zajhge/1/)\n\n<!-- prettier-ignore -->\n```js\nimport { degrees, PDFDocument, rgb, StandardFonts } from 'pdf-lib';\n\n// This should be a Uint8Array or ArrayBuffer\n// This data can be obtained in a number of different ways\n// If your running in a Node environment, you could use fs.readFile()\n// In the browser, you could make a fetch() call and use res.arrayBuffer()\nconst existingPdfBytes = ...\n\n// Load a PDFDocument from the existing PDF bytes\nconst pdfDoc = await PDFDocument.load(existingPdfBytes)\n\n// Embed the Helvetica font\nconst helveticaFont = await pdfDoc.embedFont(StandardFonts.Helvetica)\n\n// Get the first page of the document\nconst pages = pdfDoc.getPages()\nconst firstPage = pages[0]\n\n// Get the width and height of the first page\nconst { width, height } = firstPage.getSize()\n\n// Draw a string of text diagonally across the first page\nfirstPage.drawText('This text was added with JavaScript!', {\n  x: 5,\n  y: height / 2 + 300,\n  size: 50,\n  font: helveticaFont,\n  color: rgb(0.95, 0.1, 0.1),\n  rotate: degrees(-45),\n})\n\n\n// Serialize the PDFDocument to bytes (a Uint8Array)\nconst pdfBytes = await pdfDoc.save()\n\n// For example, `pdfBytes` can be:\n//   • Written to a file in Node\n//   • Downloaded from the browser\n//   • Rendered in an <iframe>\n```\n\n### Copy Pages\n\n_This example produces [this PDF](assets/pdfs/examples/copy_pages.pdf)_ (when [this PDF](assets/pdfs/with_update_sections.pdf) is used for the `firstDonorPdfBytes` variable and [this PDF](assets/pdfs/with_large_page_count.pdf) is used for the `secondDonorPdfBytes` variable).\n\n[Try the JSFiddle demo](https://jsfiddle.net/Hopding/ybank8s9/2/)\n\n<!-- prettier-ignore -->\n```js\nimport { PDFDocument } from 'pdf-lib'\n\n// Create a new PDFDocument\nconst pdfDoc = await PDFDocument.create()\n\n// These should be Uint8Arrays or ArrayBuffers\n// This data can be obtained in a number of different ways\n// If your running in a Node environment, you could use fs.readFile()\n// In the browser, you could make a fetch() call and use res.arrayBuffer()\nconst firstDonorPdfBytes = ...\nconst secondDonorPdfBytes = ...\n\n// Load a PDFDocument from each of the existing PDFs\nconst firstDonorPdfDoc = await PDFDocument.load(firstDonorPdfBytes)\nconst secondDonorPdfDoc = await PDFDocument.load(secondDonorPdfBytes)\n\n// Copy the 1st page from the first donor document, and \n// the 743rd page from the second donor document\nconst [firstDonorPage] = await pdfDoc.copyPages(firstDonorPdfDoc, [0])\nconst [secondDonorPage] = await pdfDoc.copyPages(secondDonorPdfDoc, [742])\n\n// Add the first copied page\npdfDoc.addPage(firstDonorPage)\n\n// Insert the second copied page to index 0, so it will be the \n// first page in `pdfDoc`\npdfDoc.insertPage(0, secondDonorPage)\n\n// Serialize the PDFDocument to bytes (a Uint8Array)\nconst pdfBytes = await pdfDoc.save()\n\n// For example, `pdfBytes` can be:\n//   • Written to a file in Node\n//   • Downloaded from the browser\n//   • Rendered in an <iframe>\n```\n\n### Embed PNG and JPEG Images\n\n_This example produces [this PDF](assets/pdfs/examples/embed_png_and_jpeg_images.pdf)_ (when [this image](assets/images/cat_riding_unicorn.jpg) is used for the `jpgImageBytes` variable and [this image](assets/images/minions_banana_alpha.png) is used for the `pngImageBytes` variable).\n\n[Try the JSFiddle demo](https://jsfiddle.net/Hopding/bcya43ju/5/)\n\n<!-- prettier-ignore -->\n```js\nimport { PDFDocument } from 'pdf-lib'\n\n// These should be Uint8Arrays or ArrayBuffers\n// This data can be obtained in a number of different ways\n// If your running in a Node environment, you could use fs.readFile()\n// In the browser, you could make a fetch() call and use res.arrayBuffer()\nconst jpgImageBytes = ...\nconst pngImageBytes = ...\n\n// Create a new PDFDocument\nconst pdfDoc = await PDFDocument.create()\n\n// Embed the JPG image bytes and PNG image bytes\nconst jpgImage = await pdfDoc.embedJpg(jpgImageBytes)\nconst pngImage = await pdfDoc.embedPng(pngImageBytes)\n\n// Get the width/height of the JPG image scaled down to 25% of its original size\nconst jpgDims = jpgImage.scale(0.25)\n\n// Get the width/height of the PNG image scaled down to 50% of its original size\nconst pngDims = pngImage.scale(0.5)\n\n// Add a blank page to the document\nconst page = pdfDoc.addPage()\n\n// Draw the JPG image in the center of the page\npage.drawImage(jpgImage, {\n  x: page.getWidth() / 2 - jpgDims.width / 2,\n  y: page.getHeight() / 2 - jpgDims.height / 2,\n  width: jpgDims.width,\n  height: jpgDims.height,\n})\n\n// Draw the PNG image near the lower right corner of the JPG image\npage.drawImage(pngImage, {\n  x: page.getWidth() / 2 - pngDims.width / 2 + 75,\n  y: page.getHeight() / 2 - pngDims.height,\n  width: pngDims.width,\n  height: pngDims.height,\n})\n\n// Serialize the PDFDocument to bytes (a Uint8Array)\nconst pdfBytes = await pdfDoc.save()\n\n// For example, `pdfBytes` can be:\n//   • Written to a file in Node\n//   • Downloaded from the browser\n//   • Rendered in an <iframe>\n```\n\n### Embed PDF Pages\n\n_This example produces [this PDF](assets/pdfs/examples/embed_pdf_pages.pdf)_ (when [this PDF](assets/pdfs/american_flag.pdf) is used for the `americanFlagPdfBytes` variable and [this PDF](assets/pdfs/us_constitution.pdf) is used for the `usConstitutionPdfBytes` variable).\n\n[Try the JSFiddle demo](https://jsfiddle.net/Hopding/Lyb16ocj/13/)\n\n<!-- prettier-ignore -->\n```js\nimport { PDFDocument } from 'pdf-lib'\n\n// These should be Uint8Arrays or ArrayBuffers\n// This data can be obtained in a number of different ways\n// If your running in a Node environment, you could use fs.readFile()\n// In the browser, you could make a fetch() call and use res.arrayBuffer()\nconst americanFlagPdfBytes = ...\nconst usConstitutionPdfBytes = ...\n\n// Create a new PDFDocument\nconst pdfDoc = await PDFDocument.create()\n\n// Embed the American flag PDF bytes\nconst [americanFlag] = await pdfDoc.embedPdf(americanFlagPdfBytes)\n\n// Load the U.S. constitution PDF bytes\nconst usConstitutionPdf = await PDFDocument.load(usConstitutionPdfBytes)\n\n// Embed the second page of the constitution and clip the preamble\nconst preamble = await pdfDoc.embedPage(usConstitutionPdf.getPages()[1], {\n  left: 55,\n  bottom: 485,\n  right: 300,\n  top: 575,\n})\n\n// Get the width/height of the American flag PDF scaled down to 30% of \n// its original size\nconst americanFlagDims = americanFlag.scale(0.3)\n\n// Get the width/height of the preamble clipping scaled up to 225% of \n// its original size\nconst preambleDims = preamble.scale(2.25)\n\n// Add a blank page to the document\nconst page = pdfDoc.addPage()\n\n// Draw the American flag image in the center top of the page\npage.drawPage(americanFlag, {\n  ...americanFlagDims,\n  x: page.getWidth() / 2 - americanFlagDims.width / 2,\n  y: page.getHeight() - americanFlagDims.height - 150,\n})\n\n// Draw the preamble clipping in the center bottom of the page\npage.drawPage(preamble, {\n  ...preambleDims,\n  x: page.getWidth() / 2 - preambleDims.width / 2,\n  y: page.getHeight() / 2 - preambleDims.height / 2 - 50,\n})\n\n// Serialize the PDFDocument to bytes (a Uint8Array)\nconst pdfBytes = await pdfDoc.save()\n\n// For example, `pdfBytes` can be:\n//   • Written to a file in Node\n//   • Downloaded from the browser\n//   • Rendered in an <iframe>\n```\n\n### Embed Font and Measure Text\n\n`pdf-lib` relies on a sister module to support embedding custom fonts: [`@pdf-lib/fontkit`](https://www.npmjs.com/package/@pdf-lib/fontkit). You must add the `@pdf-lib/fontkit` module to your project and register it using `pdfDoc.registerFontkit(...)` before embedding custom fonts.\n\n> **[See below for detailed installation instructions on installing `@pdf-lib/fontkit` as a UMD or NPM module.](#fontkit-installation)**\n\n_This example produces [this PDF](assets/pdfs/examples/embed_font_and_measure_text.pdf)_ (when [this font](assets/fonts/ubuntu/Ubuntu-R.ttf) is used for the `fontBytes` variable).\n\n[Try the JSFiddle demo](https://jsfiddle.net/Hopding/rgu6ca59/2/)\n\n<!-- prettier-ignore -->\n```js\nimport { PDFDocument, rgb } from 'pdf-lib'\nimport fontkit from '@pdf-lib/fontkit'\n\n// This should be a Uint8Array or ArrayBuffer\n// This data can be obtained in a number of different ways\n// If you're running in a Node environment, you could use fs.readFile()\n// In the browser, you could make a fetch() call and use res.arrayBuffer()\nconst fontBytes = ...\n\n// Create a new PDFDocument\nconst pdfDoc = await PDFDocument.create()\n\n// Register the `fontkit` instance\npdfDoc.registerFontkit(fontkit)\n\n// Embed our custom font in the document\nconst customFont = await pdfDoc.embedFont(fontBytes)\n\n// Add a blank page to the document\nconst page = pdfDoc.addPage()\n\n// Create a string of text and measure its width and height in our custom font\nconst text = 'This is text in an embedded font!'\nconst textSize = 35\nconst textWidth = customFont.widthOfTextAtSize(text, textSize)\nconst textHeight = customFont.heightAtSize(textSize)\n\n// Draw the string of text on the page\npage.drawText(text, {\n  x: 40,\n  y: 450,\n  size: textSize,\n  font: customFont,\n  color: rgb(0, 0.53, 0.71),\n})\n\n// Draw a box around the string of text\npage.drawRectangle({\n  x: 40,\n  y: 450,\n  width: textWidth,\n  height: textHeight,\n  borderColor: rgb(1, 0, 0),\n  borderWidth: 1.5,\n})\n\n// Serialize the PDFDocument to bytes (a Uint8Array)\nconst pdfBytes = await pdfDoc.save()\n\n// For example, `pdfBytes` can be:\n//   • Written to a file in Node\n//   • Downloaded from the browser\n//   • Rendered in an <iframe>\n```\n\n### Set Document Metadata\n\n_This example produces [this PDF](assets/pdfs/examples/set_document_metadata.pdf)_.\n\n[Try the JSFiddle demo](https://jsfiddle.net/Hopding/vcwmfnbe/2/)\n\n<!-- prettier-ignore -->\n```js\nimport { PDFDocument, StandardFonts } from 'pdf-lib'\n\n// Create a new PDFDocument\nconst pdfDoc = await PDFDocument.create()\n\n// Embed the Times Roman font\nconst timesRomanFont = await pdfDoc.embedFont(StandardFonts.TimesRoman)\n\n// Add a page and draw some text on it\nconst page = pdfDoc.addPage([500, 600])\npage.setFont(timesRomanFont)\npage.drawText('The Life of an Egg', { x: 60, y: 500, size: 50 })\npage.drawText('An Epic Tale of Woe', { x: 125, y: 460, size: 25 })\n\n// Set all available metadata fields on the PDFDocument. Note that these fields\n// are visible in the \"Document Properties\" section of most PDF readers.\npdfDoc.setTitle('🥚 The Life of an Egg 🍳')\npdfDoc.setAuthor('Humpty Dumpty')\npdfDoc.setSubject('📘 An Epic Tale of Woe 📖')\npdfDoc.setKeywords(['eggs', 'wall', 'fall', 'king', 'horses', 'men'])\npdfDoc.setProducer('PDF App 9000 🤖')\npdfDoc.setCreator('pdf-lib (https://github.com/Hopding/pdf-lib)')\npdfDoc.setCreationDate(new Date('2018-06-24T01:58:37.228Z'))\npdfDoc.setModificationDate(new Date('2019-12-21T07:00:11.000Z'))\n\n// Serialize the PDFDocument to bytes (a Uint8Array)\nconst pdfBytes = await pdfDoc.save()\n\n// For example, `pdfBytes` can be:\n//   • Written to a file in Node\n//   • Downloaded from the browser\n//   • Rendered in an <iframe>\n```\n\n### Read Document Metadata\n\n[Try the JSFiddle demo](https://jsfiddle.net/Hopding/eg8rfz3k/16/)\n\n<!-- prettier-ignore -->\n```js\nimport { PDFDocument } from 'pdf-lib'\n\n// This should be a Uint8Array or ArrayBuffer\n// This data can be obtained in a number of different ways\n// If your running in a Node environment, you could use fs.readFile()\n// In the browser, you could make a fetch() call and use res.arrayBuffer()\nconst existingPdfBytes = ...\n\n// Load a PDFDocument without updating its existing metadata\nconst pdfDoc = await PDFDocument.load(existingPdfBytes, { \n  updateMetadata: false \n})\n\n// Print all available metadata fields\nconsole.log('Title:', pdfDoc.getTitle())\nconsole.log('Author:', pdfDoc.getAuthor())\nconsole.log('Subject:', pdfDoc.getSubject())\nconsole.log('Creator:', pdfDoc.getCreator())\nconsole.log('Keywords:', pdfDoc.getKeywords())\nconsole.log('Producer:', pdfDoc.getProducer())\nconsole.log('Creation Date:', pdfDoc.getCreationDate())\nconsole.log('Modification Date:', pdfDoc.getModificationDate())\n```\n\nThis script outputs the following (_when [this PDF](assets/pdfs/with_cropbox.pdf) is used for the `existingPdfBytes` variable_):\n\n```\nTitle: Microsoft Word - Basic Curriculum Vitae example.doc\nAuthor: Administrator\nSubject: undefined\nCreator: PScript5.dll Version 5.2\nKeywords: undefined\nProducer: Acrobat Distiller 8.1.0 (Windows)\nCreation Date: 2010-07-29T14:26:00.000Z\nModification Date: 2010-07-29T14:26:00.000Z\n```\n\n### Draw SVG Paths\n\n_This example produces [this PDF](assets/pdfs/examples/draw_svg_paths.pdf)_.\n\n[Try the JSFiddle demo](https://jsfiddle.net/Hopding/bwaomr9h/2/)\n\n<!-- prettier-ignore -->\n```js\nimport { PDFDocument, rgb } from 'pdf-lib'\n\n// SVG path for a wavy line\nconst svgPath =\n  'M 0,20 L 100,160 Q 130,200 150,120 C 190,-40 200,200 300,150 L 400,90'\n\n// Create a new PDFDocument\nconst pdfDoc = await PDFDocument.create()\n\n// Add a blank page to the document\nconst page = pdfDoc.addPage()\npage.moveTo(100, page.getHeight() - 5)\n\n// Draw the SVG path as a black line\npage.moveDown(25)\npage.drawSvgPath(svgPath)\n\n// Draw the SVG path as a thick green line\npage.moveDown(200)\npage.drawSvgPath(svgPath, { borderColor: rgb(0, 1, 0), borderWidth: 5 })\n\n// Draw the SVG path and fill it with red\npage.moveDown(200)\npage.drawSvgPath(svgPath, { color: rgb(1, 0, 0) })\n\n// Draw the SVG path at 50% of its original size\npage.moveDown(200)\npage.drawSvgPath(svgPath, { scale: 0.5 })\n\n// Serialize the PDFDocument to bytes (a Uint8Array)\nconst pdfBytes = await pdfDoc.save()\n\n// For example, `pdfBytes` can be:\n//   • Written to a file in Node\n//   • Downloaded from the browser\n//   • Rendered in an <iframe>\n```\n\n## Deno Usage\n\n`pdf-lib` fully supports the exciting new [Deno](https://deno.land/) runtime! 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 [Pika](https://www.pika.dev/) CDN, because Deno requires all modules to be referenced via URLs.\n\n> **See also [How to Create and Modify PDF Files in Deno With pdf-lib](https://medium.com/@andrew.dillon.j/how-to-create-and-modify-pdf-files-in-deno-ffaad7099b0)**\n\n### Creating a Document with Deno\n\nBelow is the [**create document**](#create-document) example modified for Deno:\n\n```js\nimport {\n  PDFDocument,\n  StandardFonts,\n  rgb,\n} from 'https://cdn.pika.dev/pdf-lib@^1.6.0';\n\nconst pdfDoc = await PDFDocument.create();\nconst timesRomanFont = await pdfDoc.embedFont(StandardFonts.TimesRoman);\n\nconst page = pdfDoc.addPage();\nconst { width, height } = page.getSize();\nconst fontSize = 30;\npage.drawText('Creating PDFs in JavaScript is awesome!', {\n  x: 50,\n  y: height - 4 * fontSize,\n  size: fontSize,\n  font: timesRomanFont,\n  color: rgb(0, 0.53, 0.71),\n});\n\nconst pdfBytes = await pdfDoc.save();\n\nawait Deno.writeFile('out.pdf', pdfBytes);\n```\n\nIf you save this script as `create-document.ts`, you can execute it using Deno with the following command:\n\n```\ndeno run --allow-write create-document.ts\n```\n\nThe resulting `out.pdf` file will look like [this PDF](assets/pdfs/examples/create_document.pdf).\n\n### Embedding a Font with Deno\n\nHere's a slightly more complicated example demonstrating how to embed a font and measure text in Deno:\n\n```js\nimport {\n  degrees,\n  PDFDocument,\n  rgb,\n  StandardFonts,\n} from 'https://cdn.pika.dev/pdf-lib@^1.6.0';\nimport fontkit from 'https://cdn.pika.dev/@pdf-lib/fontkit@^1.0.0';\n\nconst url = 'https://pdf-lib.js.org/assets/ubuntu/Ubuntu-R.ttf';\nconst fontBytes = await fetch(url).then((res) => res.arrayBuffer());\n\nconst pdfDoc = await PDFDocument.create();\n\npdfDoc.registerFontkit(fontkit);\nconst customFont = await pdfDoc.embedFont(fontBytes);\n\nconst page = pdfDoc.addPage();\n\nconst text = 'This is text in an embedded font!';\nconst textSize = 35;\nconst textWidth = customFont.widthOfTextAtSize(text, textSize);\nconst textHeight = customFont.heightAtSize(textSize);\n\npage.drawText(text, {\n  x: 40,\n  y: 450,\n  size: textSize,\n  font: customFont,\n  color: rgb(0, 0.53, 0.71),\n});\npage.drawRectangle({\n  x: 40,\n  y: 450,\n  width: textWidth,\n  height: textHeight,\n  borderColor: rgb(1, 0, 0),\n  borderWidth: 1.5,\n});\n\nconst pdfBytes = await pdfDoc.save();\n\nawait Deno.writeFile('out.pdf', pdfBytes);\n```\n\nIf you save this script as `custom-font.ts`, you can execute it with the following command:\n\n```\ndeno run --allow-write --allow-net custom-font.ts\n```\n\nThe resulting `out.pdf` file will look like [this PDF](assets/pdfs/examples/embed_font_and_measure_text.pdf).\n\n## Complete Examples\n\nThe [usage examples](#usage-examples) provide code that is brief and to the point, demonstrating the different features of `pdf-lib`. You can find complete working examples in the [`apps/`](apps/) directory. These apps are used to do manual testing of `pdf-lib` before every release (in addition to the [automated tests](tests/)).\n\nThere are currently four apps:\n\n- [**`node`**](apps/node/) - contains [tests](apps/node/tests/) for `pdf-lib` in Node environments. These tests are a handy reference when trying to save/load PDFs, fonts, or images with `pdf-lib` from the filesystem. They also allow you to quickly open your PDFs in different viewers (Acrobat, Preview, Foxit, Chrome, Firefox, etc...) to ensure compatibility.\n- [**`web`**](apps/web/) - contains [tests](apps/web/) for `pdf-lib` in browser environments. These tests are a handy reference when trying to save/load PDFs, fonts, or images with `pdf-lib` in a browser environment.\n- [**`rn`**](apps/rn) - contains [tests](apps/rn/src/tests/) for `pdf-lib` in React Native environments. These tests are a handy reference when trying to save/load PDFs, fonts, or images with `pdf-lib` in a React Native environment.\n- [**`deno`**](apps/deno) - contains [tests](apps/deno/tests/) for `pdf-lib` in Deno environments. These tests are a handy reference when trying to save/load PDFs, fonts, or images with `pdf-lib` from the filesystem.\n\n## Installation\n\n### NPM Module\n\nTo install the latest stable version:\n\n```bash\n# With npm\nnpm install --save pdf-lib\n\n# With yarn\nyarn add pdf-lib\n```\n\nThis assumes you're using [npm](https://www.npmjs.com/) or [yarn](https://yarnpkg.com/lang/en/) as your package manager.\n\n### UMD Module\n\nYou can also download `pdf-lib` as a UMD module from [unpkg](https://unpkg.com/#/) or [jsDelivr](https://www.jsdelivr.com/). The UMD builds have been compiled to ES5, so they should work [in any modern browser](https://caniuse.com/#feat=es5). UMD builds are useful if you aren't using a package manager or module bundler. For example, you can use them directly in the `<script>` tag of an HTML page.\n\nThe following builds are available:\n\n- https://unpkg.com/pdf-lib/dist/pdf-lib.js\n- https://unpkg.com/pdf-lib/dist/pdf-lib.min.js\n- https://cdn.jsdelivr.net/npm/pdf-lib/dist/pdf-lib.js\n- https://cdn.jsdelivr.net/npm/pdf-lib/dist/pdf-lib.min.js\n\n> **NOTE:** if you are using the CDN scripts in production, you should include a specific version number in the URL, for example:\n>\n> - https://unpkg.com/pdf-lib@1.4.0/dist/pdf-lib.min.js\n> - https://cdn.jsdelivr.net/npm/pdf-lib@1.4.0/dist/pdf-lib.min.js\n\nWhen using a UMD build, you will have access to a global `window.PDFLib` variable. This variable contains all of the classes and functions exported by `pdf-lib`. For example:\n\n```javascript\n// NPM module\nimport { PDFDocument, rgb } from 'pdf-lib';\n\n// UMD module\nvar PDFDocument = PDFLib.PDFDocument;\nvar rgb = PDFLib.rgb;\n```\n\n## Fontkit Installation\n\n`pdf-lib` relies upon a sister module to support embedding custom fonts: [`@pdf-lib/fontkit`](https://www.npmjs.com/package/@pdf-lib/fontkit). You must add the `@pdf-lib/fontkit` module to your project and register it using `pdfDoc.registerFontkit(...)` before embedding custom fonts (see the [font embedding example](#embed-font-and-measure-text)). This module is not included by default because not all users need it, and it increases bundle size.\n\nInstalling this module is easy. Just like `pdf-lib` itself, `@pdf-lib/fontkit` can be installed with `npm`/`yarn` or as a UMD module.\n\n### Fontkit NPM Module\n\n```bash\n# With npm\nnpm install --save @pdf-lib/fontkit\n\n# With yarn\nyarn add @pdf-lib/fontkit\n```\n\nTo register the `fontkit` instance:\n\n<!-- prettier-ignore -->\n```js\nimport { PDFDocument } from 'pdf-lib'\nimport fontkit from '@pdf-lib/fontkit'\n\nconst pdfDoc = await PDFDocument.create()\npdfDoc.registerFontkit(fontkit)\n```\n\n### Fontkit UMD Module\n\nThe following builds are available:\n\n- https://unpkg.com/@pdf-lib/fontkit/dist/fontkit.umd.js\n- https://unpkg.com/@pdf-lib/fontkit/dist/fontkit.umd.min.js\n- https://cdn.jsdelivr.net/npm/@pdf-lib/fontkit/dist/fontkit.umd.js\n- https://cdn.jsdelivr.net/npm/@pdf-lib/fontkit/dist/fontkit.umd.min.js\n\n> **NOTE:** if you are using the CDN scripts in production, you should include a specific version number in the URL, for example:\n>\n> - https://unpkg.com/@pdf-lib/fontkit@0.0.4/dist/fontkit.umd.min.js\n> - https://cdn.jsdelivr.net/npm/@pdf-lib/fontkit@0.0.4/dist/fontkit.umd.min.js\n\nWhen using a UMD build, you will have access to a global `window.fontkit` variable. To register the `fontkit` instance:\n\n<!-- prettier-ignore -->\n```js\nvar pdfDoc = await PDFLib.PDFDocument.create()\npdfDoc.registerFontkit(fontkit)\n```\n\n## Documentation\n\nAPI documentation is available on the project site at https://pdf-lib.js.org/docs/api/.\n\nThe repo for the project site (and generated documentation files) is\nlocated here: https://github.com/Hopding/pdf-lib-docs.\n\n## Encryption Handling\n\n`pdf-lib` does not currently support modification of encrypted documents. In general, it is not advised to use `pdf-lib` with encrypted documents. However, this is a feature that could be added to `pdf-lib`. Please [create an issue](https://github.com/Hopding/pdf-lib/issues/new) if you would find this feature helpful!\n\nWhen an encrypted document is passed to `PDFDocument.load(...)`, an error will be thrown:\n\n<!-- prettier-ignore -->\n```js\nimport { PDFDocument, EncryptedPDFError } from 'pdf-lib'\n\nconst encryptedPdfBytes = ...\n\n// Assignment fails. Throws an `EncryptedPDFError`.\nconst pdfDoc = PDFDocument.load(encryptedPdfBytes)\n```\n\nThis default behavior is usually what you want. It allows you to easily detect if a given document is encrypted, and it prevents you from trying to modify it. However, if you really want to load the document, you can use the `{ ignoreEncryption: true }` option:\n\n```js\nimport { PDFDocument } from 'pdf-lib'\n\nconst encryptedPdfBytes = ...\n\n// Assignment succeeds. Does not throw an error.\nconst pdfDoc = PDFDocument.load(encryptedPdfBytes, { ignoreEncryption: true })\n```\n\nNote that **using this option does not decrypt the document**. This means that any modifications you attempt to make on the returned `PDFDocument` may fail, or have unexpected results.\n\n<h2 id=\"migrating-to-v1\">Migrating to v1.0.0</h2>\n\nThe latest release of `pdf-lib` (`v1.0.0`) includes several breaking API changes. If you have code written for older versions of `pdf-lib` (`v0.x.x`), you can use the following instructions to help migrate your code to v1.0.0.\n\nNote that many of the API methods are now asynchronous and return promises, so you'll need to `await` on them (or use promise chaining: `.then(res => ...)`).\n\n- Rename _`PDFDocumentFactory`_ to **`PDFDocument`**. `PDFDocument.create` and `PDFDocument.load` are now async (they return promises), so you'll need to `await` on them.\n\n* To create a new PDF document:\n\n  ```js\n  const pdfDoc = await PDFDocument.create();\n  ```\n\n* To retrieve and load a PDF where `pdfUrl` points to the PDF to be loaded:\n  ```js\n  const pdfBuffer = await fetch(pdfUrl).then((res) => res.arrayBuffer());\n  const pdfDoc = await PDFDocument.load(pdfBuffer);\n  ```\n\n- The purpose of making these methods asynchronous is to avoid blocking the event loop (especially for browser-based usage). If you aren't running this code client-side and are not concerned about blocking the event loop, you can speed up parsing times with:\n\n  ```js\n  PDFDocument.load(..., { parseSpeed: ParseSpeeds.Fastest })\n  ```\n\n  You can do a similar thing for save:\n\n  ```js\n  PDFDocument.save({ objectsPerTick: Infinity });\n  ```\n\n- To draw content on a page in old versions of `pdf-lib`, you needed to create a content stream, invoke some operators, register the content stream, and add it to the document. Something like the following:\n\n  ```js\n  const contentStream = pdfDoc.createContentStream(\n    drawText(\n      timesRomanFont.encodeText('Creating PDFs in JavaScript is awesome!'),\n      {\n        x: 50,\n        y: 450,\n        size: 15,\n        font: 'TimesRoman',\n        colorRgb: [0, 0.53, 0.71],\n      },\n    ),\n  );\n  page.addContentStreams(pdfDoc.register(contentStream));\n  ```\n\n  However, in new versions of `pdf-lib`, this is much simpler. You simply invoke drawing methods on the page, such as [`PDFPage.drawText`](https://pdf-lib.js.org/docs/api/classes/pdfpage#drawtext), [`PDFPage.drawImage`](https://pdf-lib.js.org/docs/api/classes/pdfpage#drawimage), [`PDFPage.drawRectangle`](https://pdf-lib.js.org/docs/api/classes/pdfpage#drawrectangle), or [`PDFPage.drawSvgPath`](https://pdf-lib.js.org/docs/api/classes/pdfpage#drawsvgpath). So the above example becomes:\n\n  ```js\n  page.drawText('Creating PDFs in JavaScript is awesome!', {\n    x: 50,\n    y: 450,\n    size: 15,\n    font: timesRomanFont,\n    color: rgb(0, 0.53, 0.71),\n  });\n  ```\n\n  Please see the [Usage Examples](#usage-examples) for more in depth examples of drawing content on a page in the new versions of `pdf-lib`. You may also find the [Complete Examples](#complete-examples) to be a useful reference.\n\n- Change _`getMaybe`_ function calls to **`get`** calls. If a property doesn't exist, then `undefined` will be returned. Note, however, that PDF name strings with need to be wrapped in `PDFName.of(...)`. For example, to look up the AcroForm object you'll need to change _`pdfDoc.catalog.getMaybe('AcroForm')`_ to **`pdfDoc.catalog.get(PDFName.of('AcroForm'))`**.\n\n  ```js\n  const acroForm = await pdfDoc.context.lookup(\n    pdfDoc.catalog.get(PDFName.of('AcroForm')),\n  );\n  ```\n\n  > v0.x.x converted the strings passed to `get` and `getMaybe` to `PDFName` objects, but v1.0.0 does not do this conversion for you. So you must always pass actual `PDFName` objects instead of strings.\n\n- To find the AcroForm field references now becomes:\n  ```js\n  const acroFieldRefs = await pdfDoc.context.lookup(\n    acroForm.get(PDFName.of('Fields')),\n  );\n  ```\n- To add a new page replace _`pdfDoc.createPage([width, height])`_ with **`pdfDoc.addPage([width, height])`**\n  ```js\n  const page = pdfDoc.addPage([500, 750]);\n  ```\n  or simply:\n  ```js\n  const page = pdfDoc.addPage();\n  ```\n\n* To get the size of the page:\n\n  ```js\n  const { width, height } = page.getSize();\n  page.getWidth();\n  page.getHeight();\n  ```\n\n* To add images replace _`pdfDoc.embedPNG`_ with **`pdfDoc.embedPng`** and _`pdfDoc.embedJPG`_ with **`pdfDoc.embedJpg`**\n\n* The `pdfDoc.embedPng` and `pdfDoc.embedJpg` methods now return `PDFImage` objects which have the width and height of the image as properties. You can also scale down the width and height by a constant factor using the `PDFImage.scale` method:\n  ```js\n  const aBigImage = await pdfDoc.embedPng(aBigImageBytes);\n  const { width, height } = aBigImage.scale(0.25);\n  ```\n  So, `const [image, dims] = pdfDoc.embedJPG(mediaBuffer)` becomes:\n  ```js\n  const image = await pdfDoc.embedJpg(mediaBuffer);\n  // image.width, image.height can be used instead of the dims object.\n  ```\n* To save the PDF replace _`PDFDocumentWriter.saveToBytes(pdfDoc)`_ with **`pdfDoc.save()`**\n\n  ```js\n  const pdfDocBytes = await pdfDoc.save();\n  ```\n\n* To display the saved PDF now becomes:\n\n  ```js\n  const pdfUrl = URL.createObjectURL(\n    new Blob([await pdfDoc.save()], { type: 'application/pdf' }),\n  );\n  window.open(pdfUrl, '_blank');\n  ```\n\n  (note: `URL.revokeObjectURL` should be called later to free up memory)\n\n* To get the PDF page count:\n\n  ```js\n  pdfDoc.getPages().length;\n  ```\n\n* To copy pages from one document to another you must now call **`destPdf.copyPages(srcPdf, srcPageIndexesArray)`** to copy pages. You can see an example of this in the [Copy Pages](#copy-pages) usage example. Admittedly, this API is slightly less ergonomic than what exists in v0.x.x, but it has two key benefits:\n\n  1. It avoids making PDFDocument.addPage and PDFDocument.insertPage async.\n     When copying multiple pages from the source document, the resulting merged document should have a smaller file size. This is because the page copying API that exists in v0.x.x was intended for copying just one or two pages.\n\n  2. When copying large numbers of pages, it could result in redundant objects being created. This new page copying API should eliminate that.\n\n  ```js\n  async function mergePdfs(pdfsToMerge: string[]) {\n    const mergedPdf = await PDFDocument.create();\n    for (const pdfCopyDoc of pdfsToMerge) {\n      const pdfBytes = fs.readFileSync(pdfCopyDoc);\n      const pdf = await PDFDocument.load(pdfBytes);\n      const copiedPages = await mergedPdf.copyPages(pdf, pdf.getPageIndices());\n      copiedPages.forEach((page) => {\n        mergedPdf.addPage(page);\n      });\n    }\n    const mergedPdfFile = await mergedPdf.save();\n    return mergedPdfFile;\n  }\n  ```\n\n* If required, you can retrieve the CropBox or MediaBox of a page like so:\n  ```js\n  const cropBox = page.node.CropBox() || page.node.MediaBox();\n  ```\n\n## Contributing\n\nWe welcome contributions from the open source community! If you are interested in contributing to `pdf-lib`, please take a look at the [CONTRIBUTING.md](CONTRIBUTING.md) file. It contains information to help you get `pdf-lib` setup and running on your machine. (We try to make this as simple and fast as possible! :rocket:)\n\n## Tutorials and Cool Stuff\n\n- [Möbius Printing helper](https://shreevatsa.net/mobius-print/) - a tool created by @shreevatsa\n- [Extract PDF pages](https://shreevatsa.net/pdf-pages/) - a tool created by @shreevatsa\n- [Travel certificate generator](https://github.com/LAB-MI/deplacement-covid-19) - a tool that creates travel certificates for French citizens under quarantine due to COVID-19\n- [How to use pdf-lib in AWS Lambdas](https://medium.com/swlh/create-pdf-using-pdf-lib-on-serverless-aws-lambda-e9506246dc88) - a tutorial written by Crespo Wang\n- [Working With PDFs in Node.js Using pdf-lib](http://thecodebarbarian.com/working-with-pdfs-in-node-js.html) - a tutorial by Valeri Karpov\n\n## Prior Art\n\n- [`pdfkit`](https://github.com/devongovett/pdfkit) is a PDF generation library for Node and the Browser. This library was immensely helpful as a reference and existence proof when creating `pdf-lib`. `pdfkit`'s code for [font embedding](src/core/embedders/CustomFontEmbedder.ts#L17-L21), [PNG embedding](src/core/embedders/PngEmbedder.ts#L7-L11), and [JPG embedding](src/core/embedders/JpegEmbedder.ts#L25-L29) was especially useful.\n- [`pdf.js`](https://github.com/mozilla/pdf.js) is a PDF rendering library for the Browser. This library was helpful as a reference when writing `pdf-lib`'s parser. Some of the code for stream decoding was [ported directly to TypeScript](src/core/streams) for use in `pdf-lib`.\n- [`jspdf`](https://github.com/MrRio/jsPDF) is a PDF generation library for the browser.\n- [`pdfmake`](https://github.com/bpampuch/pdfmake) is a PDF generation library for the browser.\n- [`hummus`](https://github.com/galkahana/HummusJS) is a PDF generation and modification library for Node environments. `hummus` is a Node wrapper around a [C++ library](https://github.com/galkahana/PDF-Writer), so it doesn't work in many JavaScript environments - like the Browser or React Native.\n- [`react-native-pdf-lib`](https://github.com/Hopding/react-native-pdf-lib) is a PDF generation and modification library for React Native environments. `react-native-pdf-lib` is a wrapper around [C++](https://github.com/galkahana/PDF-Writer) and [Java](https://github.com/TomRoush/PdfBox-Android) libraries.\n- [`pdfassembler`](https://github.com/DevelopingMagic/pdfassembler) is a PDF generation and modification library for Node and the browser. It requires some knowledge about the logical structure of PDF documents to use.\n\n## License\n\n[MIT](LICENSE.md)\n","license":"MIT","private":false,"scripts":{"lint":"yarn lint:prettier && yarn lint:tslint:src && yarn lint:tslint:tests","test":"jest --config jest.json --runInBand","build":"yarn build:cjs && yarn build:es && yarn build:esm && yarn build:esm:min && yarn build:umd && yarn build:umd:min && yarn build:downlevel-dts","clean":"rimraf ts3.4 build cjs dist es scratchpad/build coverage tsBuildInfo.json isolate*.log flamegraph.html out.pdf","testc":"jest --config jest.json --coverage && open coverage/index.html","testw":"jest --config jest.json --watch","apps:web":"http-server -c-1 .","build:es":"ttsc --module ES2015 --outDir es","apps:deno":"deno run --allow-read --allow-write --allow-run apps/deno/index.ts","apps:node":"ttsc --build apps/node/tsconfig.json && node apps/node-build/index.js","build:cjs":"ttsc --module commonjs --outDir cjs","build:esm":"rollup --config rollup.config.js --file dist/pdf-lib.esm.js --environment MODULE_TYPE:es","build:umd":"rollup --config rollup.config.js --file dist/pdf-lib.js --environment MODULE_TYPE:umd","typecheck":"tsc --noEmit --incremental false --tsBuildInfoFile null","apps:rn:ios":"cd apps/rn && yarn add ./../.. --force && react-native run-ios","get:version":"node --eval 'console.log(require(`./package.json`).version)'","release:tag":"TAG=\"v$(yarn --silent get:version)\" && git tag $TAG && git push origin $TAG","apps:web:mac":"bash -c 'sleep 1 && open http://localhost:8080/apps/web/test1.html' & yarn apps:web","release:next":"yarn publish --tag next","release:prep":"yarn clean && yarn lint && yarn typecheck && yarn test && yarn build","build:esm:min":"rollup --config rollup.config.js --file dist/pdf-lib.esm.min.js --environment MINIFY,MODULE_TYPE:es","build:umd:min":"rollup --config rollup.config.js --file dist/pdf-lib.min.js --environment MINIFY,MODULE_TYPE:umd","lint:prettier":"prettier --write \"./{src,tests}/**/*.{ts,js,json}\" --loglevel error","release:latest":"yarn publish --tag latest && yarn pack && yarn release:tag","scratchpad:run":"node scratchpad/build/scratchpad/index.js","apps:rn:android":"yarn apps:rn:emulator & cd apps/rn && yarn add ./../.. --force && react-native run-android","lint:tslint:src":"tslint --project tsconfig.json --fix","apps:rn:emulator":"emulator -avd \"$(emulator -list-avds | head -n 1)\" & bash -c 'sleep 5 && adb reverse tcp:8080 tcp:8080 && adb reverse tcp:8081 tcp:8081'","scratchpad:flame":"rimraf isolate*.log && node --prof scratchpad/build/scratchpad/index.js && node --prof-process --preprocess -j isolate*.log | flamebearer","scratchpad:start":"ttsc --build scratchpad/tsconfig.json --watch","lint:tslint:tests":"tslint --project tests/tsconfig.json --fix","build:downlevel-dts":"rimraf ts3.4 && yarn downlevel-dts . ts3.4 && rimraf ts3.4/scratchpad"},"_npmUser":{"name":"hopding","email":"andrew.dillon.j@gmail.com"},"homepage":"https://pdf-lib.js.org/","keywords":["pdf-lib","pdf","document","create","modify","creation","modification","edit","editing","typescript","javascript","library"],"repository":{"url":"git+https://github.com/Hopding/pdf-lib.git","type":"git"},"description":"Create and modify PDF files with JavaScript","directories":{},"licenseText":"MIT License\n\nCopyright (c) 2019 Andrew Dillon\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","maintainers":[{"name":"hopding","email":"andrew.dillon.j@gmail.com"}],"resolutions":{"jest/**/set-value":"^2.0.1"},"contributors":[{"url":"https://github.com/jerp","name":"jerp"},{"url":"https://github.com/gregbacchus","name":"Greg Bacchus"},{"url":"https://github.com/mlecoq","name":"Mickael Lecoq"},{"url":"https://github.com/philipjmurphy","name":"Philip Murphy"},{"url":"https://github.com/PlushBeaver","name":"Dmitry Kozliuk"},{"url":"https://github.com/samezyane","name":"Said Amezyane"},{"url":"https://github.com/multiplegeorges","name":"Georges Gabereau"},{"url":"https://github.com/GerardSmit","name":"Gerard Smit"},{"url":"https://github.com/jlmessenger","name":"jlmessenger"},{"url":"https://github.com/thebenlamm","name":"thebenlamm"},{"url":"https://github.com/cshenks","name":"cshenks"},{"url":"https://github.com/jwoodrow","name":"James Woodrow"},{"url":"https://github.com/Mogztter","name":"Guillaume Grossetie"},{"url":"https://github.com/tessi","name":"Philipp Tessenow"},{"url":"https://github.com/timKraeuter","name":"Tim Kräuter"},{"url":"https://github.com/taxilian","name":"Richard Bateman"}],"dependencies":{"pako":"^1.0.11","tslib":"^1.11.1","@pdf-lib/upng":"^1.0.1","@pdf-lib/standard-fonts":"^0.0.4"},"typesVersions":{"<=3.5":{"*":["ts3.4/*"]}},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"jest":"^25.4.0","rimraf":"^3.0.2","rollup":"^1.32.1","tslint":"^6.1.1","ts-jest":"^25.4.0","prettier":"^2.0.5","node-fetch":"^2.6.0","typescript":"^3.8.3","@types/jest":"^25.2.1","@types/pako":"^1.0.1","flamebearer":"^1.1.3","http-server":"^0.12.1","ttypescript":"^1.5.10","downlevel-dts":"^0.4.0","@pdf-lib/fontkit":"^1.0.0","@types/node-fetch":"^2.5.7","@rollup/plugin-json":"^4.0.3","rollup-plugin-terser":"^5.3.0","tslint-config-prettier":"^1.18.0","@rollup/plugin-commonjs":"^11.1.0","@rollup/plugin-node-resolve":"^7.1.3","@zerollup/ts-transform-paths":"^1.7.17"},"_npmOperationalInternal":{"tmp":"tmp/pdf-lib_1.6.1-rc1_1590340546965_0.7543352665985621","host":"s3://npm-registry-packages"},"_id":"pdf-lib@1.6.1-rc1","version":"1.6.1-rc1"}