Page 1 of 1

CefPdfPrintSettings MarginType.Custom

PostPosted: Tue Aug 21, 2018 6:00 am
by NL18
Hi,

I am trying to export a pdf from JCEF. Since my browser window is in a resizable Panel I need to adjust the image size to keep the correct aspect ratio. I am doing this by specifying MarginType.Custom in the CefPdfPrintSettings and setting the margins via the margin_* properties.

The comment in CefPdfPrintSettings.java suggests that these values are im millimeters. However, this does not appear to be true because when looking and measuring in the resulting pdf file, the margins in millimeter are roughly 1/3 the value that was specified in the properties. Did anybody else notice this and knows if this is a documentation or an implementaion problem?

Thanks for any help!

Re: CefPdfPrintSettings MarginType.Custom

PostPosted: Fri Jun 14, 2019 3:05 pm
by arrgh
I realize this is old but I thought I'd comment on it since I had this issue too. I remember digging around for this; I think I remember seeing it in Skia's documentation. Anyway you're right, the CEF documentation is incorrect - the margins are specified in points (1 pt = 1/72 inch). For example if you wanted a 1/2 inch margin you'd set the margin to 36.

Re: CefPdfPrintSettings MarginType.Custom

PostPosted: Thu Jun 27, 2019 10:25 am
by thomat65
arrgh wrote:the CEF documentation is incorrect - the margins are specified in points (1 pt = 1/72 inch). For example if you wanted a 1/2 inch margin you'd set the margin to 36.

FWIW I created this issue for CEF because I stubbed my toe on it, too: https://bitbucket.org/chromiumembedded/ ... -in-points