{"bugs":{"url":"https://github.com/Hopding/pdf-lib/issues"},"dist":{"shasum":"1a9e800dc1013d1b764362c3b8370ef62888a710","tarball":"https://registry.npmjs.org/pdf-lib/-/pdf-lib-0.3.0-rc3.tgz","fileCount":445,"integrity":"sha512-KEdmORDLjTEvKwfpfvw2UHlkkgxH9VbpliFvXBXsc3Lpwv2hWfBCur8w8mqlRH7EhgL/EdZUdfHQufTcjdEr3w==","signatures":[{"sig":"MEUCIEUtwGBXYiaik/Hn9qXDiZxS6tmS7ZGQliHwj7EvwUREAiEA+JNij0eym6r7H/sZj2PVjNoZ50pklEx8ByWfUauJOyg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3540736,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbgt6cCRA9TVsSAnZWagAAyywP+gJY9jkxw3hOin7wvirU\nRclFZjZjsvpjBPAI+0vSj47MXfolAnAvV/wphJccXCb9sycFuWIQ2PWiOBpq\nRDK84J+gu2X5xGoQQBPVJt5zaOUynczWtyCs2P7NVh7zgP3pKsjeEC81icMH\nd7RLx0MAdu6/HmcaZWigc1rLhgFyOFhaGSYaR/vUBVdhfzd4hSOq4Pm9PaUf\ndYhKx+3q1Rsz6PYS/DBIORVMPh87BTi60ikHH2a1fw62B6v7NdFdXax+Isn6\n8QwT6i+0WsDhqjrPvyyDC2g6VOwulu6snE3Ih40i61pYSo5yoEFWJFb8yiAl\nBEUOLMNNIJhmoqnu8OCg0ytSmYT9by0demAOq4bvN1gI57wnDjk3xzW9dkW1\npVMm2ErCvyZP1PDRjPrwmrm2p1Qre2T2onU4cRLs4Iwr39qPOWYISTiamIEf\n7hU4n4SL3JEmPQZB8KpxoGykPBxudz4yNy3RxfjObTWmuSMfGkAuviiqJYH0\ny81Pv98OucVstg3zsUglTB5PB2QPuZIXVLGf9YCH4FiCTbcHBT7s6TJ92lLC\n30JXJqhdjJzCZ+WWIKESN0RXRht6/Z2NUmLiW1VGUkLJJb2tjl94xUj3B3+B\nH/+FB6eKDywPidD/IUbUCkazckSvUBvaD+Sk0V0wYXBEpIOKxoeOiyJoFqaW\nxmeE\r\n=OUpL\r\n-----END PGP SIGNATURE-----\r\n"},"jest":{"globals":{"ts-jest":{"tsConfigFile":"./tsconfig.json"}},"testRegex":"(/__tests__/.*|(\\.|/)(test|spec))$","transform":{"^.+$":"ts-jest"},"collectCoverage":true,"moduleNameMapper":{"^utils":"<rootDir>/src/utils/index.ts","^core/(.*)":"<rootDir>/src/core/$1","^utils/(.*)":"<rootDir>/src/utils/$1"},"collectCoverageFrom":["<rootDir>/src/**/*.ts"],"moduleFileExtensions":["ts","js","json","node"],"testResultsProcessor":"./node_modules/jest-junit","testPathIgnorePatterns":["<rootDir>/integration-tests/","<rootDir>/node_modules/","<rootDir>/__tests__/tsconfig.json","(.*).spec.ts.snap","PDFOperatorSingletonTest.ts"],"coveragePathIgnorePatterns":["<rootDir>/node_modules/","<rootDir>/src/types/"]},"main":"lib/index.js","name":"pdf-lib","types":"lib/index.d.ts","unpkg":"dist/pdf-lib.js","author":{"name":"Andrew Dillon","email":"andrew.dillon.j@gmail.com"},"module":"es/index.js","readme":"<h1 align=\"center\">pdf-lib</h1>\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, 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  <!-- Build Status -->\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=\"Build Status\"\n    />\n  </a>\n</div>\n\n<div align=\"center\">\n  <h3>\n    <a href=\"https://github.com/Hopding/pdf-lib/tree/master/docs\">\n      Documentation\n    </a>\n    <span> | </span>\n    <a href=\"https://github.com/Hopding/pdf-lib/tree/master/examples\">\n      Examples\n    </a>\n  </h3>\n</div>\n\n## Table of Contents\n* [Motivation](#motivation)\n* [Features](#features)\n* [Usage Examples](#usage-examples)\n  * [Document Creation](#document-creation)\n  * [Document Modification](#document-modification)\n* [Installation](#installation)\n* [API Documentation](#api-documentation)\n* [Prior Art](#prior-art)\n* [License](#license)\n\n## Motivation\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 design requirements since its inception are to:\n1. Support modification (editing) of existing documents.\n2. Work in all JavaScript environments - not just in Node or the browser.\n\nThere are other good open source JavaScript PDF libraries available. However, most of them can only _create_ documents, they cannot _modify_ existing ones (e.g. [`pdfkit`](https://github.com/devongovett/pdfkit), [`jspdf`](https://github.com/MrRio/jsPDF), [`pdfmake`](https://github.com/bpampuch/pdfmake)). [`hummus`](https://github.com/galkahana/HummusJS) is a NodeJS library capable of both creating and modifying PDF documents. However, `hummus` is a Node wrapper around a [C++ library](https://github.com/galkahana/PDF-Writer). This means that it cannot run in _all_ JavaScript environments. For example, you cannot use `hummus` in the Browser or in React Native.\n\n## Features\n* Create new PDFs\n* Modify existing PDFs\n* Add Pages\n* Insert Pages\n* Remove Pages\n* Draw Text\n* Draw Images\n* Draw Vector Graphics\n* Embed Fonts\n* Embed Images\n\n## Usage Examples\nMore detailed examples are available [here](https://github.com/Hopding/pdf-lib/tree/master/examples).\n\n### Document Creation\n```javascript\nimport { PDFDocumentFactory, PDFDocumentWriter, drawText } from 'pdf-lib';\n\nconst pdfDoc = PDFDocumentFactory.create();\nconst [timesRomanFont] = pdfDoc.embedStandardFont('Times-Roman');\n\nconst page = pdfDoc\n  .createPage([350, 500])\n  .addFontDictionary('Times-Roman', timesRomanFont);\n\nconst contentStream = pdfDoc.createContentStream(\n  drawText('Creating PDFs in JavaScript is awesome!', {\n    x: 50,\n    y: 450,\n    size: 15,\n    font: 'Times-Roman',\n    colorRgb: [0, 0.53, 0.71],\n  }),\n);\n\npage.addContentStreams(pdfDoc.register(contentStream));\n\npdfDoc.addPage(page);\n\nconst pdfBytes = PDFDocumentWriter.saveToBytes(pdfDoc);\n```\n\n### Document Modification\n```javascript\nimport { PDFDocumentFactory, PDFDocumentWriter, drawText } from 'pdf-lib';\n\n// This should be a Uint8Array.\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 existingPdfDocBytes = ...\n\nconst pdfDoc = PDFDocumentFactory.load(existingPdfDocBytes);\nconst [helveticaFont] = pdfDoc.embedStandardFont('Helvetica');\n\nconst pages = pdfDoc.getPages();\nconst page  = pages[0];\n\npage.addFontDictionary('Helvetica', helveticaFont);\n\nconst contentStream = pdfDoc.createContentStream(\n  drawText('This text was added to the PDF with JavaScript!', {\n    x: 25,\n    y: 25,\n    size: 24,\n    font: 'Helvetica',\n    colorRgb: [0.95, 0.26, 0.21],\n  }),\n);\n\npage.addContentStreams(pdfDoc.register(contentStream));\n\nconst pdfBytes = PDFDocumentWriter.saveToBytes(pdfDoc);\n```\n\n## Installation\n### NPM Module\nTo install the latest stable version:\n```bash\n# With npm\nnpm install --save pdf-lib\n\n# With yarn\nyarn add pdf-lib\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\nYou can also download `pdf-lib` as a UMD module from [unpkg](https://unpkg.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\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 { PDFDocumentFactory, drawText } from 'pdf-lib';\n\n// UMD module\nvar PDFDocumentFactory = PDFLib.PDFDocumentFactory;\nvar drawText = PDFLib.drawText;\n```\n\n## API Documentation\nAPI documentation is available [here](https://github.com/Hopding/pdf-lib/tree/master/docs).\n\n## Prior Art\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](https://github.com/Hopding/pdf-lib/blob/AddDocumentation/src/core/pdf-structures/factories/PDFFontFactory.ts#L64-L68), [PNG embedding](https://github.com/Hopding/pdf-lib/blob/AddDocumentation/src/core/pdf-structures/factories/PNGXObjectFactory.ts#L19-L23), and [JPG embedding](https://github.com/Hopding/pdf-lib/blob/AddDocumentation/src/core/pdf-structures/factories/JPEGXObjectFactory.ts#L32-L36) was especially useful.\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).\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 document to use.\n\n## License\n[MIT](https://choosealicense.com/licenses/mit/)\n","license":"MIT","scripts":{"docs":"rm -rf docs && yarn typedoc --options typedoc.js src/","lint":"yarn prettier --config ./.prettierrc.json --loglevel error --write \"{src,integration-tests,__tests__}/**/*.ts\" && tslint --project ./tsconfig.json --fix","test":"jest --no-coverage --watch","it:node":"ts-node --module commonjs -r tsconfig-paths/register __integration_tests__/runners/node/index.ts","test:ci":"jest --runInBand --no-coverage","test:coverage":"jest","coverage-report":"open coverage/lcov-report/index.html","it:node:profile":"rm isolate*.log && gulp build-dev && node --prof compiled/lib/__integration_tests__/runners/node/index.js && node --prof-process --preprocess -j isolate*.log | flamebearer","jest:clear-cache":"rm -rf $TMPDIR/jest*"},"_npmUser":{"name":"hopding","email":"andrew.dillon.j@gmail.com"},"homepage":"https://github.com/Hopding/pdf-lib#readme","keywords":["pdf-lib","pdf","document","create","modify","creation","modification","edit","editing","typescript","javascript","library"],"jest-junit":{"output":"./coverage/junit.xml"},"repository":{"url":"git+https://github.com/Hopding/pdf-lib.git","type":"git"},"_npmVersion":"6.1.0","description":"Library for creating and modifying PDF files in JavaScript","directories":{},"maintainers":[{"name":"hopding","email":"andrew.dillon.j@gmail.com"}],"_nodeVersion":"10.5.0","dependencies":{"pako":"^1.0.6","buffer":"^5.0.8","lodash":"^4.17.4","png-js":"git+https://github.com/Hopding/png.js.git#9170c1451881487a625fff1cca6de4fd9949cd51","fontkit":"git+https://github.com/Hopding/fontkit.git#97eb4f461e849956a595b3e6c8366cd715f71c38","proxy-polyfill":"^0.3.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"del":"^3.0.0","gulp":"^3.9.1","jest":"^22.4.3","chalk":"^2.4.1","faker":"^4.1.0","rollup":"^0.60.7","tslint":"^5.9.1","ts-jest":"^22.4.2","ts-node":"^6.0.5","typedoc":"^0.11.1","inquirer":"^6.0.0","prettier":"^1.11.1","relative":"^3.0.2","jest-junit":"^3.6.0","typescript":"^2.7.2","@types/jest":"^22.2.2","@types/node":"^9.6.0","@types/pako":"^1.0.0","@types/faker":"^4.1.2","gulp-replace":"^1.0.0","@types/lodash":"^4.14.110","tsconfig-paths":"^3.3.2","@types/inquirer":"^0.0.41","gulp-typescript":"^4.0.1","rollup-plugin-uglify":"^4.0.0","rollup-plugin-analyzer":"^2.0.3","rollup-plugin-commonjs":"^9.1.3","typedoc-plugin-markdown":"^1.1.13","rollup-plugin-node-resolve":"^3.3.0"},"_npmOperationalInternal":{"tmp":"tmp/pdf-lib_0.3.0-rc3_1535303323902_0.1641460703565909","host":"s3://npm-registry-packages"},"_id":"pdf-lib@0.3.0-rc3","version":"0.3.0-rc3"}