Welcome Guest Search | Active Topics | Sign In | Register

@media print workaround Options
D. Pellegrini
Posted: Monday, October 30, 2017 7:22:48 PM
Rank: Newbie
Groups: Member

Joined: 7/26/2015
Posts: 3
I have an application that generates PDF invoices from PDF's using EO.Pdf. One of our clients has a requirement that we use payment coupons at the bottom of the last page of the invoice. We need to be able to use all of the area on all of the pages except for the last one and then on the last one, display the payment coupon on the bottom of that page. So it needs to be smart enough to know that if the entire payment coupon won't fit on the last page, it needs to be on its own page (at the bottom).

The following css code works perfectly fine when trying to print from the HTML rendered in the browser, but since EO.Pdf only supports @media screen, it won't work for what we need. Does anyone have experience doing this sort of thing?

<style>
/* The purpose of footer_space is merely a primitive way to force a page break when the footer (payment coupon can not fit completely on the current page. if space for the footer is not allocated then the footer will cover a portion of the final detail lines of the invoice. */
.footer_space
{
padding-top: 175px; /* Make the Pad exactly equal to the space that the footer takes and all is good in life. Force an adequate page break and leave space for the real footer */
}

@media print
{
.footer
{
position: absolute;
bottom:0px;
page-break-inside: avoid !important;
width: 100%;
}
}
</style>
eo_support
Posted: Tuesday, October 31, 2017 1:34:07 PM
Rank: Administration
Groups: Administration

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

The current version does support print media. You would need to set this property to true:

https://www.essentialobjects.com/doc/eo.pdf.htmltopdfoptions.useprintmedia.aspx

I do not believe you should use position:absolute in your footer though. That can completely mess up the paging process since the PDF converter paging process essentially works in "flow mode" from top to bottom. The key implication here is the origin of any elements is always the top/left corner of the first page, not the current page.

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.