I want to display content at the bottom of last page of pdf. This pdf is created by using tag renderdAs="pdf" for visualforce page.
[SalesForce] Display content at Bottom of last page when VF is rendered As pdf
Related Solutions
A PDF cannot be rendered using the current render engine if it's generated dynamically using JS, etc. It also cannot contain any active content. You'll need to rewrite the page to send your data to a controller from the existing page to have it render again using that data with the attribute of renderAs=PDF. You could presumably also rewrite your page to use JS remoting as another alternative.
EDIT
To clarify in response to some of the comments I see below your post. You can use a button on a page to have it rerender itself in another window using renderAs=PDF where the button and other active content has either been omitted or render=false has been applied to that content. The page simply can't have any active content or be generated dynamically from JS.
Normally to do what you're attempting, your footer would be defined using an @page
as well as an @media
. You'd do the same with the psuedo-class of page:last
. I don't see any markup in your page layout to provide for the last:page to appear. It would seem you'd want to include it in the div where your footer appears and have it as a child of the footer.
Here's an example of what you'd normally expect to see:
@page {
margin : 70pt .5in .5in .5in;
@top-center {
content : "My Header";
}
@bottom-left {
content : "My Footer on Left Side";
font-size : 10 px;
color : #808080;
}
@bottom-center {
content : "My last page content in center" ;
font-size : 10 px;
color : #808080;
}
}
You may need to do something like this where it's defined as a child of your element footer
:
footer.page:last {
// add spacing element so it appears in center
content: text;
}
To assist with that, you may also need to relate it to a .pagenumber:last
.
As a final note, it's important to remember that PDFs only support CSS 2.1, not CSS 3. So any CSS 3 notation may or may not work. Check the FlyingSaucer Documentation for the latest revisions.
Best Answer
This will work only for version 27 and below