Welcome Guest Search | Active Topics | Sign In | Register

webView:Print Options
jrk
Posted: Thursday, January 23, 2020 2:09:58 PM
Rank: Newbie
Groups: Member

Joined: 8/21/2018
Posts: 5
We've got a .Net form with the Webbrowser webview added. We want to provide printing of the contents of what's being displayed. We hooked in webView:Print(), and this does print the form, but by default on our test printer, or using a PDF writer, the form is not scaled to fit the paper or pdf size as we need it to be.

Silly question, but do we assume this is what we need to handle programmatically, or is this something that due to all the printers available and their capability, we rely on the user to handle this via their printer settings to scale the print job to fit the paper size they're printing to?

If we can programmatically do this, the documentation suggests there are ways to handle. Also suggesting ways to print the entire page or a selected frame, which is interesting to us. We are not using the PDF product...just EO.Webbrowser. Are there a few examples that someone could point out that may help us accomplish this?

Appreciated.
eo_support
Posted: Thursday, January 23, 2020 2:27:31 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
Hi,

This kind of adjustments are done by the page, not by the printing process. For example, if you have such HTML in your page:

Code: HTML/ASPX
<div style="width:100%;">
abc
<div>


Then this DIV will fill up the entire width. Here "width:100%" determines that this DIV should fill the entire width. It has nothing to do with printing.

Thanks!
jrk
Posted: Thursday, January 23, 2020 2:34:03 PM
Rank: Newbie
Groups: Member

Joined: 8/21/2018
Posts: 5
And so there's no way to adjust or inform the print job to scale the layout so the image fits the printer page?
eo_support
Posted: Thursday, January 23, 2020 2:53:26 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
I am not exactly sure what you are asking. For a web page, it's always the page itself that controls the layout. The browser only sets the parameters. The page can choose to respond to those parameters.

For example, consider a page with a number of very important buttons. The page can choose to display two buttons a row when it detects the browser window is wide (as typical on a desktop computer), and display only one button a row when it detects the browser window is narrow (as typical on a phone). In this case, the parameter the browser is setting is the browser window width, it's the author of the page that decides to respond to this parameter to make it look nicer on narrower screens. It's the same concept when you print the page. The printing process set the paper width parameter but the page has to respond to it.

On the other hand, the page author of course can choose to ignore this parameter and the user would just have to scroll the page horizontally on small screens, or the print out will be cut off on the right when the page is being printed on narrower papers.

A lot of such adjustments are automatically done by the HTML element you use. For example, a simple <p> element will always wrap the text automatically depending on page width. You don't have to explicitly do anything. However if you use a table, then it may not work the way you wanted. In this case obviously you will have to adjust your HTML to get the result you wanted.

So the short answer to your question is, whatever you want to do, you do it inside your web page.
jrk
Posted: Thursday, January 23, 2020 3:20:10 PM
Rank: Newbie
Groups: Member

Joined: 8/21/2018
Posts: 5
My apologies. Been a long day and I'm asking questions I should not be asking! I need to move up a level or two and work with simply printing the main .Net form that contains all content. I'll worry about printing at the HTML level at another time.

Again, sorry to have wasted your time.
eo_support
Posted: Friday, January 24, 2020 10:56:03 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
No issues. That's what we are here for. Hope the information we provided have helped.


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.