chunyenHuang / Hummusrecipe
Licence: mit
A powerful PDF tool for NodeJS based on HummusJS.
Stars: ✭ 274
Programming Languages
javascript
184084 projects - #8 most used programming language
Projects that are alternatives of or similar to Hummusrecipe
Combine pdf
A Pure ruby library to merge PDF files, number pages and maybe more...
Stars: ✭ 552 (+101.46%)
Mutual labels: pdf, pdf-generation, pdf-files
Resumake.io
📝 A website for automatically generating elegant LaTeX resumes.
Stars: ✭ 2,277 (+731.02%)
Mutual labels: pdf, pdf-generation
Pdf
Rust library to read, manipulate and write PDF files.
Stars: ✭ 265 (-3.28%)
Mutual labels: pdf, pdf-files
Reportbro Designer
Javascript plugin to visually design report layouts (for pdf and Excel) which can be created with reportbro-lib (a Python package) on the server.
Stars: ✭ 160 (-41.61%)
Mutual labels: pdf, pdf-generation
Openpdf
OpenPDF is a free Java library for creating and editing PDF files with a LGPL and MPL open source license. OpenPDF is based on a fork of iText. We welcome contributions from other developers. Please feel free to submit pull-requests and bugreports to this GitHub repository. ⛺
Stars: ✭ 2,174 (+693.43%)
Mutual labels: pdf, pdf-generation
Pdfcreatorandroid
Simple library to generate and view PDF in Android
Stars: ✭ 128 (-53.28%)
Mutual labels: pdf, pdf-generation
Asciidoctor Web Pdf
Convert AsciiDoc documents to PDF using web technologies
Stars: ✭ 219 (-20.07%)
Mutual labels: pdf, pdf-generation
Pdf Lib
Create and modify PDF documents in any JavaScript environment
Stars: ✭ 3,426 (+1150.36%)
Mutual labels: pdf, pdf-generation
Pdf Bot
🤖 A Node queue API for generating PDFs using headless Chrome. Comes with a CLI, S3 storage and webhooks for notifying subscribers about generated PDFs
Stars: ✭ 2,551 (+831.02%)
Mutual labels: pdf, pdf-generation
Doctron
Docker-powered html convert to pdf(html2pdf), html to image(html2image like jpeg,png),which using chrome(golang) kernel, add watermarks to pdf, convert pdf to images etc.
Stars: ✭ 141 (-48.54%)
Mutual labels: pdf, pdf-generation
Svglib
Read SVG files and convert them to other formats.
Stars: ✭ 139 (-49.27%)
Mutual labels: pdf, pdf-generation
Wasm Pdf
Generate PDF files with JavaScript and WASM (WebAssembly)
Stars: ✭ 163 (-40.51%)
Mutual labels: pdf, pdf-generation
Traprange
(Java)A Method to Extract Tabular Content from PDF Files
Stars: ✭ 236 (-13.87%)
Mutual labels: pdf, pdf-files
Docnet
DocNET is as fast PDF editing and reading library for modern .NET applications
Stars: ✭ 128 (-53.28%)
Mutual labels: pdf, pdf-files
Pdfcompare
A simple Java library to compare two PDF files
Stars: ✭ 128 (-53.28%)
Mutual labels: pdf, pdf-files
Pdfgen
Simple C PDF Writer/Generation library
Stars: ✭ 200 (-27.01%)
Mutual labels: pdf, pdf-generation
Hummus Recipe
This is an easy recipe for HummusJS with a high level class.
I hope this repo will bring more attentions from the community to help HummusJS to grow faster.
Feel free to open issues to help us!
Features
- Javascript with C++ library.
- High performance creation, modification and parsing of PDF files and streams.
- Easy to create and modify PDF files.
- Reusable components.
- Support Basic HTML elements to text
Documentation
Instructions
- GetStarted
- Coordinate System
- Create a new PDF
- Modify an existing PDF
- PDF Pages/Info/Structure
- Append PDF
- Insert PDF
- Overlay PDF
- Split PDF
- Encryption
GetStarted
npm i hummus-recipe --save
Coordinate System
In order to make things easier, I use Left-Top
as center [0,0]
instead of Left-Bottom
.
You may write and edit the pdf like you write things on papers from the left top corner.
It is similar to the Html Canvas
pdfDoc
.text('start from here', 0, 0)
.text('next line', 0, 20)
.text('some other texts', 100, 100)
...
Create a new PDF
const HummusRecipe = require('hummus-recipe');
const pdfDoc = new HummusRecipe('new', 'output.pdf',{
version: 1.6,
author: 'John Doe',
title: 'Hummus Recipe',
subject: 'A brand new PDF'
});
pdfDoc
.createPage('letter-size')
.endPage()
.endPDF();
const HummusRecipe = require('hummus-recipe');
const pdfDoc = new HummusRecipe('new', 'output.pdf');
pdfDoc
// 1st Page
.createPage('letter-size')
.circle('center', 100, 30, { stroke: '#3b7721', fill: '#eee000' })
.polygon([ [50, 250], [100, 200], [512, 200], [562, 250], [512, 300], [100, 300], [50, 250] ], {
color: [153, 143, 32],
stroke: [0, 0, 140],
fill: [153, 143, 32],
lineWidth: 5
})
.rectangle(240, 400, 50, 50, {
stroke: '#3b7721',
fill: '#eee000',
lineWidth: 6,
opacity: 0.3
})
.moveTo(200, 600)
.lineTo('center', 650)
.lineTo(412, 600)
.text('Welcome to Hummus-Recipe', 'center', 250, {
color: '#066099',
fontSize: 30,
bold: true,
font: 'Helvatica',
align: 'center center',
opacity: 0.8,
rotation: 180
})
.text('some text box', 450, 400, {
color: '#066099',
fontSize: 20,
font: 'Courier New',
strikeOut: true,
highlight: {
color: [255, 0, 0]
},
textBox: {
width: 150,
lineHeight: 16,
padding: [5, 15],
style: {
lineWidth: 1,
stroke: '#00ff00',
fill: '#ff0000',
dash: [20, 20],
opacity: 0.1
}
}
})
.comment('Feel free to open issues to help us!', 'center', 100)
.endPage()
// 2nd page
.createPage('A4', 90)
.circle(150, 150, 300)
.endPage()
// end and save
.endPDF(()=>{ /* done! */ });
Modify an existing PDF
const HummusRecipe = require('hummus-recipe');
const pdfDoc = new HummusRecipe('input.pdf', 'output.pdf');
pdfDoc
// edit 1st page
.editPage(1)
.text('Add some texts to an existing pdf file', 150, 300)
.rectangle(20, 20, 40, 100)
.comment('Add 1st comment annotaion', 200, 300)
.image('/path/to/image.jpg', 20, 100, {width: 300, keepAspectRatio: true})
.endPage()
// edit 2nd page
.editPage(2)
.comment('Add 2nd comment annotaion', 200, 100)
.endPage()
// end and save
.endPDF();
Page Info
const pdfDoc = new HummusRecipe('input.pdf', 'output.pdf');
console.log(pdfDoc.metadata);
Print the pdf structure
const pdfDoc = new HummusRecipe('input.pdf', 'output.pdf');
recipe
.structure('pdf-structure.txt')
.endPDF(done);
Append PDF
const HummusRecipe = require('hummus-recipe');
const pdfDoc = new HummusRecipe('input.pdf', 'output.pdf');
const longPDF = '/longPDF.pdf';
pdfDoc
// just page 10
.appendPage(longPDF, 10)
// page 4 and page 6
.appendPage(longPDF, [4, 6])
// page 1-3 and 6-20
.appendPage(longPDF, [[1, 3], [6, 20]])
// all pages
.appendPage(longPDF)
.endPDF();
Insert PDF
const HummusRecipe = require('hummus-recipe');
const pdfDoc = new HummusRecipe('input.pdf', 'output.pdf');
pdfDoc
// insert page3 from longPDF to current page 2
.insertPage(2, '/longPDF.pdf', 3)
.endPDF();
Overlay PDF
const HummusRecipe = require('hummus-recipe');
const pdfDoc = new HummusRecipe('input.pdf', 'output.pdf');
pdfDoc
.overlay('/overlayPDF.pdf')
.endPDF();
Split PDF
const HummusRecipe = require('hummus-recipe');
const pdfDoc = new HummusRecipe('input.pdf');
const outputDir = path.join(__dirname, 'output');
pdfDoc
.split(outputDir, 'prefix')
.endPDF();
Encryption
const HummusRecipe = require('hummus-recipe');
const pdfDoc = new HummusRecipe('input.pdf', 'output.pdf');
pdfDoc
.encrypt({
userPassword: '123',
ownerPassword: '123',
userProtectionFlag: 4
})
.endPDF();
Contributors
Thanks goes to these wonderful people (emoji key):
thebenlamm 💻 |
Matthias Nagel 💻 |
Pavlo Blazhchuk 💻 |
shaehn 💻 |
John Huang 💻 |
Andrej Sýkora 💻 |
soeyi 💻 |
Dan Halliday 💻 |
Nikhil Pai 💻 |
Erik Berreßem 💻 |
This project follows the all-contributors specification. Contributions of any kind welcome!
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].