Welcome Guest Search | Active Topics | Sign In | Register

EO.WebBrowser.Wpf set scroll bar value Options
Piotr
Posted: Wednesday, February 26, 2014 10:32:49 AM
Rank: Newbie
Groups: Member

Joined: 2/18/2014
Posts: 3
Hi,

In my application i am displaying pdf. When opening new file i would like to set vertical scroll bar to some value ( to show given part of pdf).
Is there a way to do this ?
eo_support
Posted: Wednesday, February 26, 2014 5:09:16 PM
Rank: Administration
Groups: Administration

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

I do not think there is anyway to do this through EO.WebBrowser. However if you use EO.Pdf to create the PDF file, it is possible for you to set this property:

http://www.essentialobjects.com/doc/4/eo.pdf.pdfviewerpreference.initialdestination.aspx

This set the "initial view" of the PDF file so that when PDF viewer (or the plug-in) loads that file, it will automatically scroll the file to that position. The following code demonstrates how to do this:

Code: C#
//Convert the HTML to PDF
PdfDocument doc = new PdfDocument();
HtmlToPdfResult result = HtmlToPdf.ConvertUrl(url, doc);

//Locate an HTML element in the conversion result
HtmlElement targetElement = result.HtmlDocument.GetElementById(target_element_id);

//Set the initial position to that element
doc.ViewerPreference.InitialDestination = targetElement.CreateBookmark().Destination;
doc.Save(pdf_file_name);

Hope this helps.

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.