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

Font size is significant larger in rendered pdf

Open nicolasxu opened this issue 7 years ago • 29 comments

Did I miss something?

My css is:

.page {
    width: 8.5in;
    height: 11in;
    font-size: 16px;
}

It works very well in real brower. But in rendered pdf file, only the 70% of the page width is visible, font-size is larger than it is in real browser. the remaining 30% is cut off.

My options object is empty, and it is same when I specify width and height

let options = {}
/* result is the same
let options = {
    width: '8.5in',
    height: '11in'
 }
*/
pdf.create(invoiceStr, options).toFile('./test.pdf', ()=> {}) 

What did miss?

nicolasxu avatar Apr 17 '18 01:04 nicolasxu

i have the same issue. I made the entire page width reduced by half and its started working locally. But same problem after deployment in server.

b4usat avatar Apr 30 '18 21:04 b4usat

@marcbachmann Can you please help here. I have my custom fonts for UI and am passing UI html to node api to generate PDF. But i am getting pdf with all weired fonts. How can i solve this

b4usat avatar May 01 '18 16:05 b4usat

On Windows, locally executed code works fine, however when I upload to server (linux based), while styles applied correctly, all proportions are extremely big compared to original. (Font size)

Update Apparently won't get fixed it seems: See this issue

bogacg avatar May 03 '18 14:05 bogacg

Same issue

mustafa-walkover avatar Aug 08 '18 15:08 mustafa-walkover

Same issue here, more than a year has passed... is this being taken care of at all?

DigitalLeaves avatar May 29 '19 02:05 DigitalLeaves

Same issue, tried reducing the zoom factor but not getting any changes, will this be fixed?

D0NNY avatar Aug 13 '19 11:08 D0NNY

Same here.

MartinReiche avatar Sep 20 '19 17:09 MartinReiche

same.

samura avatar Oct 06 '19 20:10 samura

Same issue. On mac.

TimofeyBiryukov avatar Oct 21 '19 11:10 TimofeyBiryukov

I have the same problem.

Xstyler85 avatar Jan 24 '20 16:01 Xstyler85

Had same issue, solved mine by using em rather than px.

anestin-femi avatar Feb 15 '20 09:02 anestin-femi

Hi all, has anyone found a solution to this? Experiencing the same thing now.

toondaey avatar Apr 20 '20 08:04 toondaey

Same here...

nitinsinghnaruka avatar May 20 '20 12:05 nitinsinghnaruka

I have the same problem

PAHJunior avatar Jun 21 '20 16:06 PAHJunior

Same problem

franjorub avatar Jun 23 '20 22:06 franjorub

Guys I found something just add to your css file this line:

html { zoom: 0.55; }

lorenzoarellano avatar Jul 13 '20 00:07 lorenzoarellano

Guys I found something just add to your css file this line:

html { zoom: 0.55; }

It's just a temporary solution. but it will work because we zoom in before render to pdf. Any solution for this issues

sun1211 avatar Jul 18 '20 12:07 sun1211

Guys I found something just add to your css file this line:

html { zoom: 0.55; }

your workaround just saves my day

gvasquez95 avatar Dec 11 '20 18:12 gvasquez95

Guys I found something just add to your css file this line: html { zoom: 0.55; }

your workaround just saves my day

Im glad for you man!

lorenzoarellano avatar Dec 12 '20 03:12 lorenzoarellano

I had this issue with html-pdf however using node-html-pdf solved it. I am aware this issue is on node-html-pdf but am posting this here incase it helps anyone having the same issue with html-pdf - silly me did not realise they were two different libraries.

oscarmeanwell avatar Dec 22 '20 16:12 oscarmeanwell

Guys I found something just add to your css file this line:

html { zoom: 0.55; }

Savior

Kushan989 avatar Feb 14 '21 16:02 Kushan989

Guys I found something just add to your css file this line:

html { zoom: 0.55; }

Thanks bro!! It works.. I did like

<html style="zoom: 0.55;">

But still searching for a permanent fix!!

Shanavaz avatar Jun 20 '21 20:06 Shanavaz

Same Problem

ernestogonzalezllano avatar Oct 08 '21 20:10 ernestogonzalezllano

You save my life, bro. Thank you so much

Leo16012000 avatar Mar 15 '22 02:03 Leo16012000

Guys I found something just add to your css file this line:

html { zoom: 0.55; }

You are a genius for thinking it.

proffnick avatar Apr 22 '22 01:04 proffnick

You save my day. Thank you so much, bro.

GerardoMolinaEstrada avatar Dec 01 '22 23:12 GerardoMolinaEstrada

I had this issue with html-pdf however using node-html-pdf solved it. I am aware this issue is on node-html-pdf but am posting this here incase it helps anyone having the same issue with html-pdf - silly me did not realise they were two different libraries.

html { zoom: 0.55; } this is not working any other solution

MrRahul2003 avatar May 26 '23 08:05 MrRahul2003

html { zoom: 0.55; } this is not working and i am creating 40 pages pdf but the middle pages are not behaving similar

kumawat6102 avatar Jan 24 '24 10:01 kumawat6102