{"_id":"@aeolun/muhammara","_rev":"2-a4b4fe4918c203faed46142b4e89749d","name":"@aeolun/muhammara","dist-tags":{"latest":"4.1.0"},"versions":{"4.1.1":{"name":"@aeolun/muhammara","version":"4.1.1","keywords":["pdf","pdfhummus","muhammarajs","hummusjs","hummus"],"author":{"name":"Julian","email":"j.hille484@gmail.com"},"license":"Apache-2.0","_id":"@aeolun/muhammara@4.1.1","maintainers":[{"name":"aeolun","email":"bart@serial-experiments.com"}],"homepage":"https://github.com/julianhille/Muhammarajs","bugs":{"url":"https://github.com/julianhille/Muhammarajs/issues"},"dist":{"shasum":"49870ad49726bae7fe978066ee7f9614b17809df","tarball":"https://registry.npmjs.org/@aeolun/muhammara/-/muhammara-4.1.1.tgz","fileCount":1345,"integrity":"sha512-6TI+PfsEC+haj4pWJc+envBZxTNlnDnJXnl9TQAr1pMMcKqGpgGIpfehGbi6DL2OjjukFGGJRUIV/0jcVN2HZw==","signatures":[{"sig":"MEQCIH7HaqB6HsjXDNzf7+19vt3nclYsd3odlF8drtB5rGrYAiAwcZylrTgJRryEToNmgGh3ceMURsdSCPLQFgyQlpbtOw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":18895105},"main":"./lib/index.js","types":"./muhammara.d.ts","binary":{"host":"https://github.com","module_name":"muhammara","module_path":"./binding","remote_path":"julianhille/MuhammaraJS/releases/download/{version}","package_name":"{node_abi}-{platform}-{arch}-{libc}.tar.gz"},"engines":{"node":">=17"},"gitHead":"40d9f453a8b6bd3c84687c18efe96a1af12c7f6c","scripts":{"test":"mocha -R tap ./tests/*.js ./tests/**/*.js --timeout 15000","install":"node-pre-gyp install --fallback-to-build ${EXTRA_NODE_PRE_GYP_FLAGS:-\"\"}","package":"node-pre-gyp package","recipe-jsdoc":"jsdoc -c jsdoc.conf","test:electron":"electron-mocha -R tap ./tests/*.js --timeout 15000","test:codestyle":"npx prettier -c ./"},"_npmUser":{"name":"aeolun","email":"bart@serial-experiments.com"},"repository":{"url":"git://github.com/julianhille/Muhammarajs.git","type":"git"},"_npmVersion":"10.5.0","description":"Create, read and modify PDF files and streams. A drop in replacement for hummusjs PDF library","directories":{},"_nodeVersion":"20.12.2","dependencies":{"linebreak":"^1.1.0","@xmldom/xmldom":"^0.8.6","memory-streams":"^0.1.3","@mapbox/node-pre-gyp":"^1.0.10"},"publishConfig":{"registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"npm":"^6.14.5","chai":"^4.3.6","jsdoc":"^3.6.4","mocha":"^10.2.0","docdash":"^2.0.1","fs-extra":"^9.1.0","prettier":"^2.7.1","@types/node":"^18.0.0"},"bundleDependencies":["@mapbox/node-pre-gyp"],"_npmOperationalInternal":{"tmp":"tmp/muhammara_4.1.1_1721959361548_0.9054018613925758","host":"s3://npm-registry-packages"}},"4.1.0":{"name":"@aeolun/muhammara","version":"4.1.0","description":"Create, read and modify PDF files and streams. A drop in replacement for hummusjs PDF library","homepage":"https://github.com/julianhille/Muhammarajs","license":"Apache-2.0","author":{"name":"Julian","email":"j.hille484@gmail.com"},"main":"./lib/index.js","types":"./muhammara.d.ts","engines":{"node":">=17"},"scripts":{"install":"node-pre-gyp install --fallback-to-build ${EXTRA_NODE_PRE_GYP_FLAGS:-\"\"}","test":"mocha -R tap ./tests/*.js ./tests/**/*.js --timeout 15000","test:codestyle":"npx prettier -c ./","test:electron":"electron-mocha -R tap ./tests/*.js --timeout 15000","package":"node-pre-gyp package","recipe-jsdoc":"jsdoc -c jsdoc.conf"},"repository":{"type":"git","url":"git://github.com/julianhille/Muhammarajs.git"},"keywords":["pdf","pdfhummus","muhammarajs","hummusjs","hummus"],"dependencies":{"@mapbox/node-pre-gyp":"^1.0.10","linebreak":"^1.1.0","memory-streams":"^0.1.3","@xmldom/xmldom":"^0.8.6"},"devDependencies":{"@types/node":"^18.0.0","chai":"^4.3.6","mocha":"^10.2.0","npm":"^6.14.5","prettier":"^2.7.1","docdash":"^2.0.1","fs-extra":"^9.1.0","jsdoc":"^3.6.4"},"binary":{"module_name":"muhammara","module_path":"./binding","remote_path":"julianhille/MuhammaraJS/releases/download/{version}","host":"https://github.com","package_name":"{node_abi}-{platform}-{arch}-{libc}.tar.gz"},"publishConfig":{"registry":"https://registry.npmjs.org/"},"bundleDependencies":["@mapbox/node-pre-gyp"],"_id":"@aeolun/muhammara@4.1.0","gitHead":"40d9f453a8b6bd3c84687c18efe96a1af12c7f6c","bugs":{"url":"https://github.com/julianhille/Muhammarajs/issues"},"_nodeVersion":"20.12.2","_npmVersion":"10.5.0","dist":{"integrity":"sha512-0t/Z2IXGJhaOo+UQJ7O1F+6JVWeiVhznj74UsXF8URrqA+dTefBD/12SMkIpLEDLnvUdrwlRr+33QuHYZ+lRdg==","shasum":"8cafb24c824b9a3077bde6ff355247b4a5866e11","tarball":"https://registry.npmjs.org/@aeolun/muhammara/-/muhammara-4.1.0.tgz","fileCount":1345,"unpackedSize":18895105,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCraUJY1JvOm+rsQbgbHgYv7oS4G6bMEA3P8EIjCNYDUQIhAINK39X1631Ko5eDWPCM5Kt+h6teeqAnWXqJNL3e1oJx"}]},"_npmUser":{"name":"aeolun","email":"bart@serial-experiments.com"},"directories":{},"maintainers":[{"name":"aeolun","email":"bart@serial-experiments.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/muhammara_4.1.0_1721959906272_0.7158145640648665"},"_hasShrinkwrap":false}},"time":{"created":"2024-07-26T02:02:41.546Z","modified":"2024-07-26T02:11:46.713Z","4.1.1":"2024-07-26T02:02:41.933Z","4.1.0":"2024-07-26T02:11:46.536Z"},"bugs":{"url":"https://github.com/julianhille/Muhammarajs/issues"},"author":{"name":"Julian","email":"j.hille484@gmail.com"},"license":"Apache-2.0","homepage":"https://github.com/julianhille/Muhammarajs","keywords":["pdf","pdfhummus","muhammarajs","hummusjs","hummus"],"repository":{"type":"git","url":"git://github.com/julianhille/Muhammarajs.git"},"description":"Create, read and modify PDF files and streams. A drop in replacement for hummusjs PDF library","maintainers":[{"name":"aeolun","email":"bart@serial-experiments.com"}],"readme":"# Welcome to MuhammaraJS\n\n[![NPM version](http://img.shields.io/npm/v/muhammara.svg?style=flat)](https://www.npmjs.org/package/muhammara)\n[![Build status](https://github.com/julianhille/MuhammaraJS/actions/workflows/build.yml/badge.svg?branch=develop)](https://github.com/julianhille/MuhammaraJS/actions/workflows/build.yml)\n\nWelcome to MuhammaraJS.\nA Fast NodeJS Module for Creating, Parsing an Manipulating PDF Files and Streams.\n\nOriginal Project (CPP base version)\nProject site is [here](http://www.pdfhummus.com).\n\nIf you are looking for a C++ Library go [here](https://github.com/galkahana/PDF-Writer).\n\n## Hummus JS is the base\n\nThis is a drop in replacement for hummusJS originally made by Galkahana.\nHe did an awesome job, but discontinued hummusjs.\n\nThe documentation for MuhammaraJS / HummusJS is still located at the\nhummusJS github wiki: available [here](https://github.com/galkahana/HummusJS/wiki)\n\n## muhammara-recipe '(formerly known as hummus-recipe) as been added\n\nMuhammara-recipe and hummus-recipe has been integrated, dependencies updated\nand is now shipped along with muhammara itself.\n\nIt serves as a drop in replacement.\n\n# Caution\n\n## Breaking changes\n\n### Version 2.x\n\nwill be incompatible with some older node and\nelectron versions because we needed to upgrade node-pre-gyp.\n\n### Version 3.x\n\n- Node < 11 and Electron < 11 removed the prebuilts\n- Renamed typo exported value from eTokenSeprator to eTokenSeparator\n\nThis won't affect a lot of you but still.\n\n### Version 4.x\n\n- Node < 15 and electron < 15 pre-builts have been removed\n- Ubuntu 18.04 has been removed from github actions and so it is unable to build on 18.04.\n  This means the glibc has been raised to 2.31 which might break pre-builts for you.\n  It is still possible to build for older glibc version.\n\n# Installation\n\n```\nnpm install muhammara\n\n```\n\n# Replace hummusJS with MuhammaraJS for hummus\n\nReplace:\n\n```\nlet hummus = require('hummus')\n```\n\nWith:\n\n```\nlet muhammara = require('muhammara')\n```\n\n# Replace hummus-recipe or muhammara-recipe with MuhammaraJS\n\nReplace:\n\n`const HummusRecipe = require('hummus-recipe');`\n\nWith:\n\n```\nconst HummusRecipe = require('muhammara').Recipe;\n```\n\n# Documentation\n\n## Muhammara\n\nYou can find samples and documentation [here](./docs/Home.md)\n\n### Muhammara Recipe:\n\nTo generate the documentation you could clone this repo and execute:\n\n`npm run recipe-jsdoc`\n\n## Recipe\n\n### Instructions\n\n- [GetStarted](#getstarted)\n- [Coordinate System](#coordinate-system)\n- [Create a new PDF](#create-a-new-pdf)\n- [Modify an existing PDF](#modify-an-existing-pdf)\n- [PDF Pages/Info/Structure](#page-info)\n- [Append PDF](#append-pdf)\n- [Insert PDF](#insert-pdf)\n- [Overlay PDF](#overlay-pdf)\n- [Split PDF](#split-pdf)\n- [Encryption](#encryption)\n\n### GetStarted\n\n```bash\nconst Recipe = require('muhammara').Recipe\n```\n\n### Coordinate System\n\nIn order to make things easier, I use `Left-Top` as center `[0,0]` instead of `Left-Bottom`.\nYou may write and edit the pdf like you write things on papers from the left top corner.\nIt is similar to the [Html Canvas](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage)\n\n```javascript\npdfDoc\n    .text('start from here', 0, 0)\n    .text('next line', 0, 20)\n    .text('some other texts', 100, 100)\n    ...\n```\n\n### Create a new PDF\n\n```javascript\nconst Recipe = require(\"muhammara\").Recipe;\n\nconst pdfDoc = new Recipe(\"new\", \"output.pdf\", {\n  version: 1.6,\n  author: \"John Doe\",\n  title: \"Hummus Recipe\",\n  subject: \"A brand new PDF\",\n});\n\npdfDoc.createPage(\"letter-size\").endPage().endPDF();\n```\n\n```javascript\nconst Recipe = require(\"muhammara\").Recipe;\nconst pdfDoc = new Recipe(\"new\", \"output.pdf\");\n\npdfDoc\n  // 1st Page\n  .createPage(\"letter-size\")\n  .circle(\"center\", 100, 30, { stroke: \"#3b7721\", fill: \"#eee000\" })\n  .polygon(\n    [\n      [50, 250],\n      [100, 200],\n      [512, 200],\n      [562, 250],\n      [512, 300],\n      [100, 300],\n      [50, 250],\n    ],\n    {\n      color: [153, 143, 32],\n      stroke: [0, 0, 140],\n      fill: [153, 143, 32],\n      lineWidth: 5,\n    }\n  )\n  .rectangle(240, 400, 50, 50, {\n    stroke: \"#3b7721\",\n    fill: \"#eee000\",\n    lineWidth: 6,\n    opacity: 0.3,\n  })\n  .moveTo(200, 600)\n  .lineTo(\"center\", 650)\n  .lineTo(412, 600)\n  .text(\"Welcome to Hummus-Recipe\", \"center\", 250, {\n    color: \"#066099\",\n    fontSize: 30,\n    bold: true,\n    font: \"Helvatica\",\n    align: \"center center\",\n    opacity: 0.8,\n    rotation: 180,\n  })\n  .text(\"some text box\", 450, 400, {\n    color: \"#066099\",\n    fontSize: 20,\n    font: \"Courier New\",\n    strikeOut: true,\n    highlight: {\n      color: [255, 0, 0],\n    },\n    textBox: {\n      width: 150,\n      lineHeight: 16,\n      padding: [5, 15],\n      style: {\n        lineWidth: 1,\n        stroke: \"#00ff00\",\n        fill: \"#ff0000\",\n        dash: [20, 20],\n        opacity: 0.1,\n      },\n    },\n  })\n  .comment(\"Feel free to open issues to help us!\", \"center\", 100)\n  .endPage()\n  // 2nd page\n  .createPage(\"A4\", 90)\n  .circle(150, 150, 300)\n  .endPage()\n  // end and save\n  .endPDF(() => {\n    /* done! */\n  });\n```\n\n#### Create a new PDF as a Buffer\n\n```javascript\nconst Recipe = require(\"muhammara\").Recipe;\n\nconst pdfDoc = new Recipe(Buffer.from(\"new\"), null, {\n  version: 1.6,\n  author: \"John Doe\",\n  title: \"Hummus Recipe\",\n  subject: \"A brand new PDF\",\n});\n\nconst pdfBuffer = pdfDoc.createPage(\"letter-size\").endPage().endPDF();\n```\n\n### Modify an existing PDF\n\n```javascript\nconst Recipe = require(\"muhammara\").Recipe;\nconst pdfDoc = new Recipe(\"input.pdf\", \"output.pdf\");\n\npdfDoc\n  // edit 1st page\n  .editPage(1)\n  .text(\"Add some texts to an existing pdf file\", 150, 300)\n  .rectangle(20, 20, 40, 100)\n  .comment(\"Add 1st comment annotation\", 200, 300)\n  .image(\"/path/to/image.jpg\", 20, 100, { width: 300, keepAspectRatio: true })\n  .endPage()\n  // edit 2nd page\n  .editPage(2)\n  .comment(\"Add 2nd comment annotation\", 200, 100)\n  .endPage()\n  // end and save\n  .endPDF();\n```\n\n### Page Info\n\n```javascript\nconst pdfDoc = new Recipe(\"input.pdf\", \"output.pdf\");\nconsole.log(pdfDoc.pageInfo(1));\n```\n\n#### Print the pdf structure\n\n```javascript\nconst pdfDoc = new Recipe(\"input.pdf\", \"output.pdf\");\n\nrecipe.structure(\"pdf-structure.txt\").endPDF(done);\n```\n\n### Append PDF\n\n```javascript\nconst Recipe = require(\"muhammara\").Recipe;\nconst pdfDoc = new Recipe(\"input.pdf\", \"output.pdf\");\nconst longPDF = \"/longPDF.pdf\";\n\npdfDoc\n  // just page 10\n  .appendPage(longPDF, 10)\n  // page 4 and page 6\n  .appendPage(longPDF, [4, 6])\n  // page 1-3 and 6-20\n  .appendPage(longPDF, [\n    [1, 3],\n    [6, 20],\n  ])\n  // all pages\n  .appendPage(longPDF)\n  .endPDF();\n```\n\n### Insert PDF\n\n```javascript\nconst Recipe = require(\"muhammara\").Recipe;\nconst pdfDoc = new Recipe(\"input.pdf\", \"output.pdf\");\n\npdfDoc\n  // insert page3 from longPDF to current page 2\n  .insertPage(2, \"/longPDF.pdf\", 3)\n  .endPDF();\n```\n\n### Overlay PDF\n\n```javascript\nconst Recipe = require(\"muhammara\").Recipe;\nconst pdfDoc = new Recipe(\"input.pdf\", \"output.pdf\");\n\npdfDoc.overlay(\"/overlayPDF.pdf\").endPDF();\n```\n\n### Split PDF\n\n```javascript\nconst Recipe = require(\"muhammara\").Recipe;\nconst pdfDoc = new Recipe(\"input.pdf\");\nconst outputDir = path.join(__dirname, \"output\");\n\npdfDoc.split(outputDir, \"prefix\").endPDF();\n```\n\n### Encryption\n\n```javascript\nconst Recipe = require(\"muhammara\").Recipe;\nconst pdfDoc = new Recipe(\"input.pdf\", \"output.pdf\");\n\npdfDoc\n  .encrypt({\n    userPassword: \"123\",\n    ownerPassword: \"123\",\n    userProtectionFlag: 4,\n  })\n  .endPDF();\n```\n","readmeFilename":"README.md"}