0

I am creating a pdf file using html-pdf librarby in node js from an html file.

The Pdf looks like this enter image description here

My code is

const createSettlementPDFFile = function (htmlString, fileName) {
    return new Promise((resolve, reject) => {
        let filePath = '/tmp/' + fileName;
        pdf.create(htmlString, {format: 'A6', timeout: 600000})
           .toFile(filePath,function (err, data) {
               if (err) {
                   logger.error('Error while creating the pdf file ::-> ', err.stack);
                   return reject(err);
               } else {
                   return resolve(data);
               }
            });
    });
};

Is there any option where we can convert it into a single page and increase the width of the pdf page.

Giuk Kim
  • 170
  • 10
Aakarshit
  • 49
  • 6

1 Answers1

0

https://www.npmjs.com/package/html-pdf?activeTab=readme

I guess you are using this lib.

{format: 'A6', timeout: 600000}

this makes page size to A6.

so page is sperated.

uses like this

{
  "height": "100in",        // allowed units: mm, cm, in, px
  "width": "20in"             // allowed units: mm, cm, in, px
}

I don't know how big you can set, but you can choose the appropriate size.

if value is too big, there will be empty space at the end of page.

Therefore, it is not a solution that can be applied to all sizes of documents.

Giuk Kim
  • 170
  • 10