Welcome Guest Search | Active Topics | Sign In | Register

Help with .Net 4.5 and Auto scaling Options
DCG
Posted: Monday, October 17, 2022 10:50:04 AM
Rank: Newbie
Groups: Member

Joined: 11/16/2015
Posts: 6
Hi EO,
We are currently experiencing problems with 'EO.Web for MVC.net'.
Whenever we convert a .cshtml to PDF we are experiencing random scaling of the content on the output PDF.
The scaling varies with every export we make.

The only (seemingly) scaling we use for the conversion is as following:
MVCToPDF.RenderAsPDF();
HtmlToPdf.Options.PageSize = PdfPageSizes.A4;
HtmlToPdf.Options.OutputArea = new RectangleF(0.5f, 0.5f, 7.5f, 10f);

We are currently using version: 17.2.43


We also have tried setting the following values to 'None' autofit X / autofix Y. and tried using a @Page property for scaling but our output keeps getting scaled randomly resulting into zoomed-in or zoomed-out content on the PDF.
Are you familiar with such problems and what would be a solution we could try?

Regards
DCG
Posted: Tuesday, October 18, 2022 7:32:40 AM
Rank: Newbie
Groups: Member

Joined: 11/16/2015
Posts: 6
We have currently updated to the last version of EO.PDF that is compatible with .Net 4.5 Framework, which is 21.1.85. But the scaling issues keep occuring.
eo_support
Posted: Tuesday, October 18, 2022 9:46:04 AM
Rank: Administration
Groups: Administration

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

Setting AutoFitX to None would disable scaling. However all options you set must be set BEFORE you call RenderAsPDF. Calling it afterwards has no effect.

Another way to control auto scaling is to force the converter to see a bigger page width. For example, you can put something in your page like this:

Code: HTML/ASPX
<div style="width:1024px;height:1px;"></div>


This will force the converter to see your page as at least 1024px wide. Page width is what determines the scale factor.

If you only wants to force page width in the PDF converter, you can do it with JavaScript like this:

Code: HTML/ASPX
<div id="forceConverterWidth" style="height:1px;"></div>


Code: JavaScript
if (eoapi && eoapi.isEOPdf())
    document.getElementById("forceConverterWidth").style.width = "1024px";


Hope this helps.

Thanks!
DCG
Posted: Wednesday, October 19, 2022 4:18:52 AM
Rank: Newbie
Groups: Member

Joined: 11/16/2015
Posts: 6
Hi eo_support,

Using the autofix and other calls before the RenderAsPDF call actually did the trick and we are now able to generate a PDF that doesnt scale randomly.

Thank you for the explanation!
eo_support
Posted: Wednesday, October 19, 2022 8:53:52 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Great. Glad to hear that it's working for you!


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.