PrintToPDFAsync, Setting PageHeight, PageWidth no longer functioning (CEF 2623)
On Win7, 49Pre-release (CEF 2623) Using the CEFSharp.Wpf.Example as the base. modifying the MainWindow PrintToPdfCommandBinding method
from :
var success = await browserViewModel.WebBrowser.PrintToPdfAsync(dialog.FileName, new PdfPrintSettings
{
MarginType = CefPdfPrintMarginType.Custom,
MarginBottom = 10,
MarginTop = 0,
MarginLeft = 20,
MarginRight = 10
});
to:
var success = await browserViewModel.WebBrowser.PrintToPdfAsync(dialog.FileName, new PdfPrintSettings
{
MarginType = CefPdfPrintMarginType.Custom,
MarginBottom = 10,
MarginTop = 0,
MarginLeft = 20,
MarginRight = 10,
PageHeight = 356,
PageWidth = 216
});
results in the method hanging and occasionally crashing the subprocess.
after running, debug.log contains:
[0408/154906:ERROR:ipc_channel_win.cc(217)] pipe error: 109
[0408/154906:ERROR:ipc_channel_win.cc(217)] pipe error: 109
[0408/154906:WARNING:raw_channel_win.cc(532)] WriteFile: The pipe is being closed. (0xE8)
[0408/154906:WARNING:channel.cc(359)] RawChannel write error
An issue has been created upstream in CEF, issue added here for reference.
master has been updated to 2704, please test again if you have a chance.
I have tested this with release 51.0.0 and it is still an issue.
Still an issue with release 55.0.0
Output page size in microns.
I believe the issue is in the units of measure your passing in, 216 x 356 is tiny in microns.
The following works fine for me.
var success = await browserViewModel.WebBrowser.PrintToPdfAsync(dialog.FileName, new PdfPrintSettings
{
MarginType = CefPdfPrintMarginType.Custom,
MarginBottom = 10,
MarginTop = 0,
MarginLeft = 20,
MarginRight = 10,
PageWidth = 210000,
PageHeight = 297000
});
Thank you for pointing that out - completely missed that. modifying the scale has resolved the issues I've been seeing. pleased to see we have such high precision on our PDF page sizes :+1: