PDF Generation in Javascript
How to generate PDFs using TTA in Javascript.
Generate PDFs in Javascript
import { TextToAnything } from "@texttoanything/nodets";
const TTA = new TextToAnything(/*API token here*/);
const PDFFile = await TTA.generatePDF("test.pdf", {
header: "Header HTML", // optional
html: "<h1>Hello world!</h1>",
footer: "Footer HTML", // optional
landscape: false, // false -> portrait, true -> landscape mode (default)
format: "A4",
});
Use TTA's PDF generation in Javascript to create PDFs from HTML content. You can customize the header, footer, and layout (portrait/landscape) of the PDF.
The generated PDF file will be returned as a Blob.