Rank: Newbie Groups: Member
Joined: 10/3/2014 Posts: 1
|
When converting html to PDF, is there any way to predetermine the viewing mode. I noticed that PDFs can scale to the size of the iFrame or the embedded object viewer.
I also noticed that some browsers display the PDF differently. Firefox show the PDF in full width view based on the size of the browser window -- it scales proportionately. Chrome shows it at one size only and it does not scale.
Any trick to getting the PDF to scale on all browsers (IE11, FF, Chrome and Safari) and mobile browser (Android and iOS)?
Thanks.
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi, You can take a look of this class: http://www.essentialobjects.com/doc/4/eo.pdf.pdfviewerpreference.aspxThe code will be something like this:
Code: C#
//Convert into a PdfDocument object
PdfDocument doc = new PdfDocument();
HtmlToPdf.ConvertUrl(url, doc);
//Set the FitWindow ViewerPreference. See the above link
//for other available ViewerPreference properties
doc.ViewerPreference.FitWindow = true;
However as the name suggest, it's a "preference", so a viewer (in your case, a browser) may decide not to honor it. So if you already tried it and still does not work, then probably there is no way to do it since these properties are directly mapped to the corresponding flags in the PDF file. Thanks!
|