Welcome Guest Search | Active Topics | Sign In | Register

Scrollbar appearing in PDF When Using HtmlToPdf.ConvertUrl Options
Burton F
Posted: Friday, May 3, 2013 1:00:34 PM
Rank: Newbie
Groups: Member

Joined: 5/3/2013
Posts: 5

Hi,

I am using the ConvertUrl method and Options.VisibleElementIds to generate a PDF and it is working with one drawback.

For some reason a scrollbar is appearing on the right hand side, the full height of the PDF.

The scroll bar is not shown on the web page being converted and the <div> that is being extracted is not particularly high.

How do I suppress this?
eo_support
Posted: Friday, May 3, 2013 3:47:34 PM
Rank: Administration
Groups: Administration

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

Can you isolate the problem into a test HTML file and post the HTML file? We will be very happy to take a look as soon as we have that.

Thanks!
Burton F
Posted: Friday, May 3, 2013 5:54:09 PM
Rank: Newbie
Groups: Member

Joined: 5/3/2013
Posts: 5
Hi,

It's not easy to isolate the HTML ..... I am pointing at a SharePoint 2010 Web Part page ( and looking for a specific DIV within in ).

I found this internet facing SharePoint page : http://www.toddklindt.com/default.aspx

And when I try to PDF it I get the same results .... a horizontal and vertical browser scrollbar.

You can see the same result on your online converter demo.
eo_support
Posted: Friday, May 3, 2013 6:05:01 PM
Rank: Administration
Groups: Administration

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

The vertical scroll bar is caused by your HTML. You will see that scroll bar even in your browser.

The horizontal scroll bar appears because by default, a "PDF page" is narrower than a typical browser window. By default the PDF page is 6.5 inch wide (8.5 inch excluding one inch margin on each side), at 96 pixel/inch that will be 624 pixel. If you narrow your browser window to that size, you will see horizontal scroll bar too.

There are two ways to eliminate the horizontal scrollbar: the increase the paper size (setting HtmlToPdf.Options.PageSize), or to change the zoom level (HtmlToPdf.Options.ZoomLevel). For example, if you set ZoomLevel to 0.5, then the same 6.5 inch wide paper will fit 624 / 0.5 = 1248 pixels, that is wide enough to eliminate horizontal scrollbars for most pages because many pages are designed to fit 1028 pixels wide.

Thanks!
Burton F
Posted: Thursday, May 9, 2013 9:43:06 AM
Rank: Newbie
Groups: Member

Joined: 5/3/2013
Posts: 5
Unfortunately even if I increase the page size ( I set it to a height of 10 * A4 ) or set the zoom level I am still getting a vertical scrollbar.

The actual contents of the PDF are generated perfectly which is very frustrating as it's not usable with a rouge scrollbar!
Burton F
Posted: Thursday, May 9, 2013 9:56:12 AM
Rank: Newbie
Groups: Member

Joined: 5/3/2013
Posts: 5
Is there any way to "crop" the generated PDF? If I could slice off a couple of inches from the right-hand it would work nicely.
eo_support
Posted: Thursday, May 9, 2013 2:54:56 PM
Rank: Administration
Groups: Administration

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

No. I do not believe there is anything to do that. As to the vertical scrollbar, we have already told you very clearly that you will need to modify your HTML to fix that.

Thanks!
Burton F
Posted: Thursday, May 9, 2013 5:35:50 PM
Rank: Newbie
Groups: Member

Joined: 5/3/2013
Posts: 5
Hi,

That's a shame. The software I am trying to integrate into is a SharePoint web part and thus I don't have access to the overall HTML that is used to generate a page.

So near.... yet so far. Never mind.

Thanks
eo_support
Posted: Thursday, May 9, 2013 7:20:28 PM
Rank: Administration
Groups: Administration

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

The goal of the HTML to PDF converter is to render your HTML faithfully. We can not invent things off the standard by ourselves. So if your HTML generates a scrollbar, a browser will render a scroll bar, and we will render a scrollbar. It is not practical for us to add additional logic on top of that. Rendering the result exactly the same as a browser is the goal here. So we can not change that. Hope you understand.

Thanks!


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.