pdf-creator-node icon indicating copy to clipboard operation
pdf-creator-node copied to clipboard

Render HTML in landscape desktop mode

Open benripka opened this issue 3 years ago • 1 comments

Hi there, I'm looking to get a PDF generated from the HTML of my website which uses bootstrap and is responsive to displays size. I'm finding that the node-pdf-creator always renders it in it's mobile mode. Is there any options / suggestions on how to force the creator render the HTML + CSS in desktop mode?

I have tried setting the width and height very wide, and using landscape mode to no avail. Any help would be appreciated.

Here is my generation script, without templating data yet:

import * as fs from "fs";

// Read HTML Template
let html = fs.readFileSync('template.html', 'utf8')

let options = {
    orientation: "landscape",
    height: "20in",
    width: "40in",
}

let document = {
    html: html,
    data: {
        inspection: [],
        photos: []
    },
    path: "./output.pdf"
};

pdf.create(document, options)
    .then(res => {
        console.log(res)
    })
    .catch(error => {
        console.error(error)
    });

benripka avatar Dec 17 '21 18:12 benripka

+1 for this...

noudadrichem avatar Jan 09 '22 21:01 noudadrichem