joshua-gould / Canvas2pdf
Licence: mit
Export your HTML canvas to PDF
Stars: ✭ 96
Programming Languages
javascript
184084 projects - #8 most used programming language
Projects that are alternatives of or similar to Canvas2pdf
Pdfmerge
Command-line utility for merging, splicing, and rotating PDF documents.
Stars: ✭ 88 (-8.33%)
Mutual labels: pdf
Remarks
Extract highlights, scribbles, and annotations from PDFs marked with the reMarkable tablet. Export to Markdown, PDF, PNG, and SVG
Stars: ✭ 94 (-2.08%)
Mutual labels: pdf
Official Bash Logo
Everything you need to start using the official GNU Bash logo
Stars: ✭ 89 (-7.29%)
Mutual labels: pdf
Puppeteer Dart
A Dart library to automate the Chrome browser over the DevTools Protocol. This is a port of the Puppeteer API
Stars: ✭ 92 (-4.17%)
Mutual labels: pdf
Vectorgraphics2d
Graphics2D implementations to export various vector file formats
Stars: ✭ 87 (-9.37%)
Mutual labels: pdf
Portablesigner2
PortableSigner - A Commandline and GUI Tool to digital sign PDF files with X.509 certificates
Stars: ✭ 92 (-4.17%)
Mutual labels: pdf
Android Databinding
this is the databinding framework of android . help to binding data to the view.
Stars: ✭ 93 (-3.12%)
Mutual labels: pdf
Waveview
A wave view of android,can be used as progress bar.
Stars: ✭ 1,294 (+1247.92%)
Mutual labels: canvas
Sunwell
Canvas-based high quality Hearthstone card renderer
Stars: ✭ 93 (-3.12%)
Mutual labels: canvas
React Tint
A React component that applies image processing filters to an image using Processing
Stars: ✭ 89 (-7.29%)
Mutual labels: canvas
Canvacord
Powerful image manipulation tool to manipulate images easily.
Stars: ✭ 87 (-9.37%)
Mutual labels: canvas
Bouncing Balls
Bouncing balls simulation using plain JavaScript
Stars: ✭ 96 (+0%)
Mutual labels: canvas
Officeproducer
Produce doc/docx/pdf format from doc/docx template
Stars: ✭ 95 (-1.04%)
Mutual labels: pdf
Canvas2PDF
Canvas2PDF exports an HTML canvas to PDF. In other words, this library lets you build a PDF document using the canvas API.
How it works
We create a mock 2d canvas context. Use the canvas context like you would on a normal canvas. As you call methods, we use PDFKit to generate a PDF document.
Browser Usage
//Create a new PDF canvas context.
var ctx = new canvas2pdf.PdfContext(blobStream());
//draw your canvas like you would normally
ctx.fillStyle='yellow';
ctx.fillRect(100,100,100,100);
// more canvas drawing, etc...
//convert your PDF to a Blob and save to file
ctx.stream.on('finish', function () {
var blob = ctx.stream.toBlob('application/pdf');
saveAs(blob, 'example.pdf', true);
});
ctx.end();
Node Usage
PDFDocument = require('pdfkit')
const fs = require('fs')
const canvas2pdf = require('canvas2pdf')
const file = fs.createWriteStream('example.pdf')
//Create a new PDF canvas context.
const ctx = new canvas2pdf.PdfContext(file)
//draw your canvas like you would normally
ctx.fillStyle = 'yellow'
ctx.fillRect(100, 100, 100, 100)
// more canvas drawing, etc...
ctx.stream.on('finish', function () {
file.end()
})
ctx.end()
Dependencies
- PDFKit
- blob-stream required when using in a web browser.
Using with node.js
canvas2pdf
works with node.js. Note that neither a DOM or canvas library is needed.
Interactive Browser Demo
Notes
- Inspired by Canvas2Svg
- Calling fill and then stroke consecutively only executes fill
- Some canvas 2d context methods are not implemented yet (e.g. setTransform and arcTo)
Status
License
MIT
Developer Dependencies
- Ghostscript and GraphicsMagick are required for running tests
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].