Skip to content

Generate an empty PDF #21

Description

@nde-mesdocteurs

Hi,
I tried to generate a pdf and got and empty white document. What's is wrong ?
`
const pdf = require('lx-pdf')(path.resolve(__dirname, '../../server/pdfTemplates/template.json'));

    let json = require(path.resolve(__dirname, '../../server/pdfTemplates/template.json'));

    pdf.loadTemplate(json);
    pdf.print(function(data, errPdf) {
        pdf.clear();
        res.set('Content-Type','application/pdf');  // octet-stream
        res.set('Content-Disposition',
          'attachment;filename=Feuille.pdf');
        res.send(data);
    });

`

{ "name": "Origin Template Care Sheet", "version": "1.0.0", "fonts": { "default": { "size": 12, "color": "#000000", "name": "../../client/shared/assets/fonts/arial.ttf" }, "body": { "size": 10, "color": "#000000", "name": "../../client/shared/assets/fonts/arial.ttf" } }, "footer": { "format": { "align": "center", "height": 60, "textmargin": { "left": 10, "top": 10, "right": 10 } }, "data": "Test" }, "options": { "pages": [ { "layout": { "size": "A4", "layout": "portrait", "margin": { "top": 20, "left": 20, "bottom": 20, "right": 20 } }, "background": { "color" : "#FF0000", "filename": "./images/sheetempty.png", "imageformat": { "fit": [100, 100] } }, "sections": { "infoTTC": { "text": "(1) Montant", "font": { "name": "../../client/shared/assets/fonts/arial.ttf", "size": 6, "color": "#000000" }, "format": { "align": "left", "left": 20, "top": 20, "width": 550, "height": 200 } } } } ] } }

Thanks a lot

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions