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

There some margins/padding in output pdf

Open code-by opened this issue 7 years ago • 6 comments
trafficstars

Hello! When I put <div> with absolute position at (0, 0) it appeared in page at top left corner, but without this style properties it appeared with some margins (or page padding) about 2 x 2 mm. My html don't have any styles. It is possible to deal with it? Thank you.

p.s. ver. is 2.2.0

code-by avatar Feb 22 '18 08:02 code-by

Me too. And I've already set border: '0'

AssKicker0214 avatar Feb 23 '18 08:02 AssKicker0214

@AssKicker0214 I have found solution

    body {
      margin: 0;
    }

try it

code-by avatar Feb 26 '18 21:02 code-by

Thank you for your information, but it's weird because I don't even have a 'body', I just pass a 'div' to the 'html-pdf' plugin. I've tried your suggestion but nothing happened. Maybe I should pass a whole 'html' instead. Thank you very much!

At 2018-02-27 05:56:56, "code-by" [email protected] wrote:

@AssKicker0214 I have found solution body { margin: 0; } try it

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

AssKicker0214 avatar Feb 27 '18 12:02 AssKicker0214

@AssKicker0214 lets try whole html

code-by avatar Feb 27 '18 14:02 code-by

Sounds like phantom.js emulates what most browsers do by default, ie. a margin on the body. (and if you're passing a div it will wrap it)

mattblackdev avatar May 11 '18 14:05 mattblackdev

didn't work, same problem here

gxanshu avatar Jun 16 '23 01:06 gxanshu