|
Rank: Newbie Groups: Member
Joined: 3/25/2014 Posts: 4
|
Hi Support
I have a Web Application, in that I am exporting a Chart which is rendered in HTML5. When we generate the PDFs, some of the Charts not taking full width of the Page. In another case, when we specify the ScaleToFit in AutoFitX, returns the blank page. Please let me know how to solve the above issues. Please let me know how to log the issues happen while generating PDF. Please find below the sample url to Convert as PDF. (http://115.160.226.116/IntelliviewNXT/Dashboards/IntegrateDashboardExport.aspx?company=1&Dashboard=3&FromSchedule=1&SRName=49&FilterDoc=2ahp4xqpg15tmxmrzbjzqs55.xml&UserID=3) .
Please find below the Settings for Generating the PDF.
HtmlToPdf.Options.ZoomLevel = 0.85f; HtmlToPdf.Options.PageSize = new SizeF(PdfPageSizes.Letter.Width, PdfPageSizes.Letter.Height); HtmlToPdf.Options.OutputArea = new RectangleF(0.5f, 0.5f, 7.5f, 10f);
Thanks and Regards, Balamurugan
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi, Please remove the overflow:hidden attribute on your body CSS rule inside your stylenew.css:
Code: CSS
body
{
height: 100%;
width: 100%;
margin: 0px;
padding: 0px;
overflow: hidden;
}
When you set AutoFitX to ScaleToFit, we try to detect the minimum required width for your page without triggering a horizontal scroll bar. So for example, if your page can display fine without triggering a horizontal scroll bar when the browser window width is 600 pixel but will trigger a horizontal scrollbar if the width is less than 600 pixel, then we would take 600 pixel as the full page width and then calculate a scale factor based on that. However if you have overflow:hidden on your body element, then your page would never trigger horizontal scrollbar at any width. This result in our code reaching the conclusion that your page would display fine even at 0 width. As such it would proceed without rendering anything. Once you remove your the overflow:hidden attribute AutoFitX should work fine for you. If you still wish to keep that attribute when the page is rendered inside a real browser, you can do it with JavaScript:
Code: JavaScript
//Set the body element's overflow to "hidden" only
//if the page is NOT running inside EO.Pdf
if (typeof(eopdf) == "undefined")
body.style.overflow = "hidden";
Hope this helps. Please let us know if this works for you. Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 3/25/2014 Posts: 4
|
Hi Support,
" So for example, if your page can display fine without triggering a horizontal scroll bar when the browser window width is 600" , Can we have any settings to change the Browser window width relating to the Screen Resolution. It if it there is will be very helpful, and after removing the overflow attribute from the page / CSS, it is not working in our case. please let me know how to solve this issue.
Thanks and Regards, Balamurugan
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
We will look into it and see if we can support that. If we can, we will be able to provide a new build to you either today or tomorrow.
The root of the problem is how your web page uses the window width to load the graph. So for example, if user does the following with your page:
1. Open the browser window and set it to a smaller width; 2. Load your report page. Your report page loads using the current browser width; 3. Now user resizes the browser window to be wider, your graph does not grow to fit in the page. Now you have the same problem on the screen as you have in the PDF.
We perform similar steps in our converter in order to detect an ideal "window width". We will look into it to see if we can skip those steps when both AuotFitX and AutoFitY is set to none.
Thanks!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi, We have posted a new build that will allow you to precisely control the EO.Pdf browser "window" size. In order to use this feature, you must set both AutoFitX and AutoFitY to None. For example:
Code: C#
//These are your original settings
HtmlToPdf.Options.ZoomLevel = 0.85f;
HtmlToPdf.Options.PageSize = new SizeF(PdfPageSizes.Letter.Width, PdfPageSizes.Letter.Height);
HtmlToPdf.Options.OutputArea = new RectangleF(0.5f, 0.5f, 7.5f, 10f);
//These two must be set to "None"
HtmlToPdf.Options.AutoFitX = HtmlToPdfAutoFitMode.None;
HtmlToPdf.Options.AutoFitY = HtmlToPdfAutoFitMode.None;
Once you set AutoFitX and AutoFitY to none, EO.Pdf will not try to automatically detect window width. For the above code, the final window width will be OutputArea.Width in inch * 96 / ZoomLevel = 7 * 96 / 0.85 = 791. Please take a look and let us know if it works for you. Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 3/25/2014 Posts: 4
|
Hi Support, Thanks for your prompt reply and Build, We will test the options with our local environment and let you know on Monday.
Thanks and Regards, Balamurugan.
|
|
Rank: Newbie Groups: Member
Joined: 3/25/2014 Posts: 4
|
Hi Support,
Thanks for your Support, We have purchased your component. We are having a requirement, the opened PDF (Viewer) should have "Fit to window width and enable scrolling" enabled by default. To achieve this we have used the following coding lines. PdfDocument xPDF = new PdfDocument(FileName); xPDF.ViewerPreference.FitWindow = true; xPDF.Save(FileName);
The above mentioned code is compatible for ADOBE 11.0.9 / 11.0.10 (Desktop browsers) with resolution like (1280 X 1024, 1366 X 768), but it is not working with higher resolutions. Can you please guide us to solve this issue.
Thanks and Regards, Balamurugan.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,196
|
Hi,
The property you set is the right property. This property does not control how the chart is render on the page (for example, whether the chart occupies half page or full page). It controls how Adobe Reader (or other PDF viewer program) displays the page (for example, display one page at a time or two pages at a time). This option does not change anything inside the page.
If the problem you are referring is that that you wish the chart to fill the whole page but it is not doing so, you will need to revisit the AutoFit property. You may also want to try different values for HtmlToPdf.Options.AutoAdjustForDPI property and see if it changes anything.
Thanks!
|
|