edisonneza / jspdf-invoice-template

PDF template created to generate invoices based on props object. Using jsPDF library.

Home Page:https://edisonneza.github.io/jspdf-invoice-template

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Directly saving as PDF - Node

lokacoding opened this issue · comments

Hi this code works in Node 18 to generate the datauri string.

var pdfCreated = jsPDFInvoiceTemplate.default({
    ...invoiceObject,
    outputType: OutputType.DataUriString,
    returnJsPDFDocObject: true,
    fileName: "Invoice 2024",
    orientationLandscape: false,
    compress: true
});

console.log(pdfCreated.dataUriString);

How to save this directly as pdf? I think there is a function but I dont get it.
Thanks!

Hi,
try the other outputTypes. If none of them works, try to see how to create a file in nodejs using blob.