Created
August 4, 2024 09:32
-
-
Save sartimo/e206d2fadf6461f4491bed83b3027008 to your computer and use it in GitHub Desktop.
Generate CV from PDFkit using BunJS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const PDFDocument = require('pdfkit'); | |
const fs = require('fs'); | |
// Create a document | |
const doc = new PDFDocument(); | |
// Pipe the document to a file | |
doc.pipe(fs.createWriteStream('output.pdf')); | |
// Add some content | |
doc | |
.fontSize(25) | |
.text('My Curriculum Vitae', { align: 'center' }) | |
.moveDown() | |
.fontSize(16) | |
.text('Name: John Doe') | |
.text('Email: john.doe@example.com') | |
.moveDown() | |
.text('Experience:') | |
.fontSize(12) | |
.text('Software Developer at Company XYZ') | |
.moveDown() | |
.text('Education:') | |
.text('B.Sc. in Computer Science') | |
.moveDown() | |
.text('Skills:') | |
.text('- JavaScript') | |
.text('- Node.js') | |
.text('- PDF Generation') | |
.moveDown() | |
.text('References available upon request.'); | |
// Finalize the PDF and end the stream | |
doc.end(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment