Created
February 17, 2020 18:51
-
-
Save buddylindsey/278cb6d1d8ede504e52772f9a6159326 to your computer and use it in GitHub Desktop.
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 pdf = require("pdfjs"); | |
const fs = require("fs"); | |
const run = async () => { | |
const doc = new pdf.Document(); | |
doc.pipe(fs.createWriteStream("./test.pdf")); | |
doc.text("Hello World"); | |
const table = doc.table({ | |
widths: [256, 256], | |
padding: 5, | |
borderWidth: 1 | |
}); | |
const row1 = table.row(); | |
row1.cell("I am text", { | |
textAlign: "justify", | |
backgroundColor: 0xdddddd | |
}); | |
row1.cell("I am text hear me roar for a really long time. YAYs", { | |
textAlign: "justify", | |
backgroundColor: 0xeeeeee | |
}); | |
const row2 = table.row(); | |
row2.cell("I am text hear me roar for a really long time. YAYs", { | |
textAlign: "justify" | |
}); | |
row2.cell("I am text", { | |
textAlign: "justify" | |
}); | |
// const newDoc = await doc; | |
try { | |
await doc.end(); | |
} catch (error) { | |
console.log(error); | |
} | |
}; | |
run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment