add typst.ts
This commit is contained in:
15
index.ts
15
index.ts
@@ -1 +1,14 @@
|
||||
console.log("Hello via Bun!");
|
||||
import { $typst } from "@myriaddreamin/typst.ts";
|
||||
import fs from "fs";
|
||||
const typstSource = `
|
||||
= Hello
|
||||
|
||||
My name is Typst!
|
||||
`;
|
||||
const pdfBuffer = await $typst.pdf({ mainContent: typstSource });
|
||||
|
||||
if (!pdfBuffer) {
|
||||
throw new Error("Failed to generate PDF");
|
||||
}
|
||||
|
||||
fs.writeFileSync("output.pdf", pdfBuffer);
|
||||
|
||||
Reference in New Issue
Block a user