|
Rank: Advanced Member Groups: Member
Joined: 1/5/2015 Posts: 60
|
Hi We are having some challenges regarding print from embedded pdf-viewers and iframes. It seems that an extra margin (some time large) is added to the printed page. We've tried changing the PageSettings margins options in the BeforePrint event, but it doesn't seem to have any effect in this case. We see the same behavior in Google Chrome, but here it is possible to adjust the margins in the print preview, by changing "More settings" -> "Margins" to "None". Is it possible to control the margin before printing in the same way in the EO.WebBrowser? You can try it out yourselves with this pdf viewer: https://mozilla.github.io/pdf.js/web/viewer.html.Any help appreciated
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi,
Please try the latest build (16.2.50) and see if it works for you. We have just fixed an issue related to PDF printing in 16.2.44.0. So the issue might have already been resolved.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 1/5/2015 Posts: 60
|
I get the same behavior using the latest build, 16.2.50, unfortunately.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Have you tried 16.2.50 with custom printing settings? The difference between older build and the current build is not whether the default margin is big or small, but is whether it takes your custom printing settings.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 1/5/2015 Posts: 60
|
Hi again, I've just tried changing the printing settings for build 16.2.50, (again). And when printing from https://mozilla.github.io/pdf.js/web/viewer.html: Neither setting
Code: Visual Basic.NET
e.PrinterSettings.DefaultPageSettings.Margins = New Margins(0, 0, 0, 0)
e.PageSettings.Margins = New Margins(0, 0, 0, 0)
nor
Code: Visual Basic.NET
e.PrinterSettings.DefaultPageSettings.Margins = New Margins(150, 500, 0, 0)
e.PageSettings.Margins = New Margins(150, 500, 0, 0)
in the before print event has any effect on the printed page. (Only tested with that particular embedded pdf viewer). Whereas this works on regular pages. Setting the e.PageSettings.Landscape = True has an effect though, if that is usable information. To clarify I use the "print" button in the pdf viewer, so the print request comes from script. The code in eventhandler currently looks like this:
Code: Visual Basic.NET
Private Sub WebView_BeforePrint(sender As Object, e As EO.WebBrowser.BeforePrintEventArgs)
e.PrinterSettings.DefaultPageSettings.Margins = New Margins(150, 500, 0, 0)
e.PageSettings.Margins = New Margins(150, 500, 0, 0)
e.Continue(False)
End Sub
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi,
We have looked into this. You will not be able to override printing margins with this PDF library. The reason is because the JavaScript code is doing the printing itself explicitly through a canvas object. For a regular printing, the printing code set up the canvas (this is where the printing margin is applied) and then hand it over to the page contents (various HTML element). For this particular library, it completely overrides the printing process and uses its own code for printing. So the only way to override printing margin is through whatever interface (if any) provided through them.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 1/5/2015 Posts: 60
|
Ok, I see.
I'll take a look at the library and see if I can find anything useful.
Thank you for looking into it.
|
|