DevelopingMagic / pdfassembler

MIT License
183 stars 34 forks source link

ReferenceError: File is not defined #4

Open stevebaldwin21 opened 6 years ago

stevebaldwin21 commented 6 years ago

A reference error is thrown when attempting to save the pdf assembly without having filesaver.

const PDFAssembler = require('pdfassembler').PDFAssembler;

async function main() {
    var pdf = new PDFAssembler("receipt.pdf");
    var structure = await pdf.getPDFStructure();

    structure['/Root']['/Pages']['/Kids'][0]['/Contents'] = [{
        'stream': "1 0 0 1 72 708 cm BT /Helv 12 Tf (Hello world!) Tj ET"
    }];

    // ReferenceError: File is not defined
    pdf.assemblePdf("output.pdf");
}
main();

Possibly add it as a dependency?

Awesome lib though!