Welcome Guest Search | Active Topics | Sign In | Register

EO.Pdf and Bootstrap 3 Options
Minasu
Posted: Thursday, November 21, 2013 2:10:24 PM
Rank: Newbie
Groups: Member

Joined: 11/21/2013
Posts: 2
Good-afternoon,

While evaluating the use of EO.Pdf, we attempted to generate the output of a page created with Bootstrap 3.
It seems the Pdf output that is generated used the 'mobile' version of the site.

To replicate, you can use the live test link:
http://www.essentialobjects.com/Products/EOPdf/UrlToPdf.aspx

Generate the Pdf for the Bootstrap 3 site:
http://getbootstrap.com/

You will see the Pdf that is generated matches the site that appears on smaller devices.

Can you clarify/confirm that the fluid framework in Bootstrap 3 can be supported by EO.Pdf?
In particular, can you describe how the component can generate the output targeted for larger devices (e.g. desktops)?

Note: Our work around at this time is re-creating the entire page with different framework/structure (e.g. Bootstrap 2). Unfortunately, long-term this is not an ideal approach, since it would require maintaining a completely separate structure.

Thanks in advance!
eo_support
Posted: Thursday, November 21, 2013 2:29:52 PM
Rank: Administration
Groups: Administration

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

Bootstrap is pure CSS/JavaScript based so we should support it fine.

The reason that it appears to generate output for mobile device is because the default "paper size" of a PDF page is only 6.5 inch (8.5 inch excludes 2 inch margin on each side). At 96 DPI that gives you a pixel width of 624 pixels. That's much narrower than most desktop screens. We choose to honor the true "paper size" by default because many people needs to print out the result PDF file and when they do, the size matters.

You can change both the physical size and the logical size of the paper. You can find more details about how to change page size (physical size in inch) here:

http://www.essentialobjects.com/doc/4/htmltopdf/page_size.aspx

The "logical size" of a page (in pixel) is calculated as physical_size_in_inch * DPI (dots per inch) / scale_factor. So once the physical size is set, both DPI value and scale factor can affect logical size. To change logical size, you would usually change scale factor instead of the DPI. For example, if you choose a scale factor value of 0.5, then the output will be scaled down to half of its original size. That means a 13 inch wide contents can now fit into a 6.5 inch wide paper. If the DPI remains the same, this would give you 13 * 96 = 1248 pixels, thus doubling the pixel width.

When EO.Pdf converts a page, it will try to choose a scale factor that can fit the whole HTML contents. So for example, if your HTML contents indeed is 1248 pixel width, then it will set scale factor to 0.5 automatically. However if your page displays fine at 624 pixel with nothing being cut off, then it will set scale factor to 1. There are various options for you to control the scaling options, including a manual scale factor value:

http://www.essentialobjects.com/doc/4/htmltopdf/auto_fit.aspx

Hope this will help you to achieve the desired result. Please feel free to let us know if you still have any questions.

Thanks!
Minasu
Posted: Thursday, November 21, 2013 2:44:28 PM
Rank: Newbie
Groups: Member

Joined: 11/21/2013
Posts: 2
Thank you for the quick reply and detailed response.

I will ask the team to experiment accordingly and hopefully we can achieve the results that we need.

Cheers!
eo_support
Posted: Thursday, November 21, 2013 2:48:22 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
No problem. Please feel free to let us know if you run into any other issues.

Thanks!
Kevin
Posted: Wednesday, November 12, 2014 6:17:20 AM
Rank: Member
Groups: Member

Joined: 8/27/2013
Posts: 11
Hi,

I have the same problem, I've tried setting the below but I still get the mobile version rendered as the PDF. What am I missing?

HtmlToPdf.Options.PageSize = PdfPageSizes.A4;
HtmlToPdf.Options.OutputArea = new RectangleF(0.5f, 0.5f, 7.5f, 10f);
HtmlToPdf.Options.AutoAdjustForDPI = true;
eo_support
Posted: Wednesday, November 12, 2014 9:20:17 AM
Rank: Administration
Groups: Administration

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

Have you tried setting zoom factor?

Thanks
Kevin
Posted: Wednesday, November 12, 2014 9:47:52 AM
Rank: Member
Groups: Member

Joined: 8/27/2013
Posts: 11
Ah thanks, all I needed in the end was:

HtmlToPdf.Options.ZoomLevel = 0.8F;


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.