Welcome Guest Search | Active Topics | Sign In | Register

Embedded viewer and iframe print with extra margin Options
Jeppe HS
Posted: Thursday, November 3, 2016 10:08:30 AM
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
eo_support
Posted: Thursday, November 3, 2016 1:36:23 PM
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!
Jeppe HS
Posted: Friday, November 4, 2016 5:43:05 AM
Rank: Advanced Member
Groups: Member

Joined: 1/5/2015
Posts: 60
I get the same behavior using the latest build, 16.2.50, unfortunately.
eo_support
Posted: Friday, November 4, 2016 7:53:58 AM
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!
Jeppe HS
Posted: Monday, November 7, 2016 1:58:03 AM
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


eo_support
Posted: Thursday, November 10, 2016 12:48:00 PM
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!
Jeppe HS
Posted: Tuesday, November 15, 2016 4:55:09 AM
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.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.