marcbachmann / node-html-pdf

This repo isn't maintained anymore as phantomjs got dreprecated a long time ago. Please migrate to headless chrome/puppeteer.
MIT License
3.56k stars 545 forks source link

Buffer size using Docker #562

Open btbensoft opened 4 years ago

btbensoft commented 4 years ago

I don't understand why when I'm using docker the buffer size is very heavy?

the situation :

code sample

pdf.create(_.request.html, { "height": "500px", "width": "500px"})
                .toBuffer((err, buffer) => MyBuffer(err, buffer, callback));

function MyBuffer(err, buffer, callback) {
    console.log("Buffer Size:", buffer.byteLength)
    callback(null, { file: buffer })
}

docker file

FROM node:12.16.1
WORKDIR /usr/src/app
COPY package.json ./
RUN yarn

COPY . .

EXPOSE 50051
CMD ["node", "index.js"]

console Using App Buffer Size: 899898 (pdf about 820ko) console Using Docker Buffer Size: 4483628 (pdf about 4,2Mo)

When i using docker app my buffer size is completely different. Same code / same HTML / same computer