{"id":13576857,"url":"https://github.com/chunyenHuang/hummusRecipe","last_synced_at":"2025-04-05T09:30:24.783Z","repository":{"id":22912605,"uuid":"97635663","full_name":"chunyenHuang/hummusRecipe","owner":"chunyenHuang","description":"A powerful PDF tool for NodeJS based on HummusJS.","archived":false,"fork":false,"pushed_at":"2023-04-18T18:44:31.000Z","size":6794,"stargazers_count":342,"open_issues_count":78,"forks_count":91,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-04-14T20:06:49.748Z","etag":null,"topics":["nodejs","overlay-pdf","pdf","pdf-files","pdf-generation","pdf-manipulation","pdf-modification","pdf-parsing"],"latest_commit_sha":null,"homepage":"https://hummus-recipe.s3.amazonaws.com/docs/Recipe.html","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chunyenHuang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-18T19:25:14.000Z","updated_at":"2024-06-18T14:00:35.060Z","dependencies_parsed_at":"2024-06-18T14:00:18.245Z","dependency_job_id":"233290c9-2fc8-424a-aeb7-17291f7f42dd","html_url":"https://github.com/chunyenHuang/hummusRecipe","commit_stats":{"total_commits":328,"total_committers":21,"mean_commits":"15.619047619047619","dds":0.2621951219512195,"last_synced_commit":"cdf157c3c1a67b64ae1808c5e90ff112f4105aac"},"previous_names":[],"tags_count":57,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chunyenHuang%2FhummusRecipe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chunyenHuang%2FhummusRecipe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chunyenHuang%2FhummusRecipe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chunyenHuang%2FhummusRecipe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chunyenHuang","download_url":"https://codeload.github.com/chunyenHuang/hummusRecipe/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247317820,"owners_count":20919444,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nodejs","overlay-pdf","pdf","pdf-files","pdf-generation","pdf-manipulation","pdf-modification","pdf-parsing"],"created_at":"2024-08-01T15:01:15.053Z","updated_at":"2025-04-05T09:30:24.736Z","avatar_url":"https://github.com/chunyenHuang.png","language":"JavaScript","funding_links":["https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=VKYRPLFE2PT7L\u0026source=url"],"categories":["JavaScript"],"sub_categories":[],"readme":"# Hummus Recipe\n[![All Contributors](https://img.shields.io/badge/all_contributors-10-orange.svg?style=flat-square)](#contributors)\n\n[![npm version](https://badge.fury.io/js/hummus-recipe.svg)](https://badge.fury.io/js/hummus-recipe)\n[![Build Status](https://travis-ci.org/chunyenHuang/hummusRecipe.svg?branch=master)](https://travis-ci.org/chunyenHuang/hummusRecipe)\n[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=VKYRPLFE2PT7L\u0026source=url)\n\nThis is an easy recipe for [HummusJS](https://github.com/galkahana/HummusJS) with a high level class.\n\nI hope this repo will bring more attentions from the community to help [HummusJS](https://github.com/galkahana/HummusJS) to grow faster. \n\nFeel free to open issues to help us!\n\n## Features\n\n* Javascript with C++ library.\n* High performance creation, modification and parsing of PDF files and streams.\n* Easy to create and modify PDF files.\n* Reusable components.\n* Support Basic HTML elements to text\n\n## Documentation\n\n* [Hummus Recipe Documentation](https://hummus-recipe.s3.amazonaws.com/docs/Recipe.html)\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\nnpm i hummus-recipe --save\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 HummusRecipe = require('hummus-recipe');\nconst pdfDoc = new HummusRecipe('new', 'output.pdf',{\n    version: 1.6,\n    author: 'John Doe',\n    title: 'Hummus Recipe',\n    subject: 'A brand new PDF'\n});\n\npdfDoc\n    .createPage('letter-size')\n    .endPage()\n    .endPDF();\n```\n\n```javascript\nconst HummusRecipe = require('hummus-recipe');\nconst pdfDoc = new HummusRecipe('new', 'output.pdf');\npdfDoc\n    // 1st Page\n    .createPage('letter-size')\n    .circle('center', 100, 30, { stroke: '#3b7721', fill: '#eee000' })\n    .polygon([ [50, 250], [100, 200], [512, 200], [562, 250], [512, 300], [100, 300], [50, 250] ], {\n        color: [153, 143, 32],\n        stroke: [0, 0, 140],\n        fill: [153, 143, 32],\n        lineWidth: 5\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(()=\u003e{ /* done! */ });\n```\n\n## Modify an existing PDF\n\n```javascript\nconst HummusRecipe = require('hummus-recipe');\nconst pdfDoc = new HummusRecipe('input.pdf', 'output.pdf');\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 annotaion', 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 annotaion', 200, 100)\n    .endPage()\n    // end and save\n    .endPDF();\n```\n\n## Page Info\n\n```javascript\nconst pdfDoc = new HummusRecipe('input.pdf', 'output.pdf');\nconsole.log(pdfDoc.metadata);\n```\n\n### Print the pdf structure\n\n```javascript\nconst pdfDoc = new HummusRecipe('input.pdf', 'output.pdf');\nrecipe\n    .structure('pdf-structure.txt')\n    .endPDF(done);\n```\n\n## Append PDF\n\n```javascript\nconst HummusRecipe = require('hummus-recipe');\nconst pdfDoc = new HummusRecipe('input.pdf', 'output.pdf');\nconst longPDF = '/longPDF.pdf';\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, [[1, 3], [6, 20]])\n    // all pages\n    .appendPage(longPDF)\n    .endPDF();\n```\n\n## Insert PDF\n\n```javascript\nconst HummusRecipe = require('hummus-recipe');\nconst pdfDoc = new HummusRecipe('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 HummusRecipe = require('hummus-recipe');\nconst pdfDoc = new HummusRecipe('input.pdf', 'output.pdf');\n\npdfDoc\n    .overlay('/overlayPDF.pdf')\n    .endPDF();\n```\n\n## Split PDF\n\n```javascript\nconst HummusRecipe = require('hummus-recipe');\nconst pdfDoc = new HummusRecipe('input.pdf');\nconst outputDir = path.join(__dirname, 'output');\n\npdfDoc\n    .split(outputDir, 'prefix')\n    .endPDF();\n```\n\n## Encryption\n\n```javascript\nconst HummusRecipe = require('hummus-recipe');\nconst pdfDoc = new HummusRecipe('input.pdf', 'output.pdf');\n\npdfDoc\n    .encrypt({\n        userPassword: '123',\n        ownerPassword: '123',\n        userProtectionFlag: 4\n    })\n    .endPDF();\n```\n\n## Contributors\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore --\u003e\n\u003ctable\u003e\u003ctr\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/thebenlamm\"\u003e\u003cimg src=\"https://avatars2.githubusercontent.com/u/5175102?v=4\" width=\"100px;\" alt=\"thebenlamm\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003ethebenlamm\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/chunyenHuang/hummusRecipe/commits?author=thebenlamm\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"https://www.bitfactory.io\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/510180?v=4\" width=\"100px;\" alt=\"Matthias Nagel\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eMatthias Nagel\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/chunyenHuang/hummusRecipe/commits?author=matthiasnagel\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/gios\"\u003e\u003cimg src=\"https://avatars0.githubusercontent.com/u/6967294?v=4\" width=\"100px;\" alt=\"Pavlo Blazhchuk\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003ePavlo Blazhchuk\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/chunyenHuang/hummusRecipe/commits?author=gios\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/shaehn\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/13596544?v=4\" width=\"100px;\" alt=\"shaehn\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eshaehn\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/chunyenHuang/hummusRecipe/commits?author=shaehn\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"https://www.linkedin.com/in/johnhuangguo/\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/12788155?v=4\" width=\"100px;\" alt=\"John Huang\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eJohn Huang\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/chunyenHuang/hummusRecipe/commits?author=chunyenHuang\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"http://andrejsykora.com\"\u003e\u003cimg src=\"https://avatars0.githubusercontent.com/u/821336?v=4\" width=\"100px;\" alt=\"Andrej Sýkora\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAndrej Sýkora\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/chunyenHuang/hummusRecipe/commits?author=neonerd\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"http://soeyi.me\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/38489160?v=4\" width=\"100px;\" alt=\"soeyi\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003esoeyi\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/chunyenHuang/hummusRecipe/commits?author=soeyi\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\u003c/tr\u003e\u003ctr\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"https://dan.halliday.work/technology/\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/1068575?v=4\" width=\"100px;\" alt=\"Dan Halliday\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eDan Halliday\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/chunyenHuang/hummusRecipe/commits?author=danhalliday\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"http://www.nikhilpi.com\"\u003e\u003cimg src=\"https://avatars0.githubusercontent.com/u/5175964?v=4\" width=\"100px;\" alt=\"Nikhil Pai\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eNikhil Pai\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/chunyenHuang/hummusRecipe/commits?author=nikhilpi\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/she11sh0cked\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/22623152?v=4\" width=\"100px;\" alt=\"Erik Berreßem\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eErik Berreßem\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/chunyenHuang/hummusRecipe/commits?author=she11sh0cked\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/table\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FchunyenHuang%2FhummusRecipe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FchunyenHuang%2FhummusRecipe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FchunyenHuang%2FhummusRecipe/lists"}