I am attempting to place a footer image in the bottom-right section of the last page of the Visualforce PDF only. I have found a solution that use named pages, however I cannot seem to get the following code to work. It doesn't seem to read the named page's properties at all.

<apex:page renderAs="pdf" showHeader="false" applyhtmlTag="false" applyBodyTag="false">
          <style type="text/css" media="print">
            @page { margin: 0in;}
            @page last {
                margin-bottom: 10%;
                @bottom-right {
                    content: "hi"
            body, html {
              margin: 0 !important; 
              padding: 0 !important;
            .lastPage {
                 page: last

        <div>I can span multiple pages</div>
        <div class="lastPage"></div>


Is there something that I am missing? Any insight would be greatly appreciated.

1 Answer 1


I don't think "page:last" is correct. I found the following: https://stackoverflow.com/questions/42136333/css-paged-media-last-page-selector which appears to be a solution for what you are trying to do.

Excerpt of the CSS in that solution (edited to match your class name):

.lastPage {
    page: last_page;
    page-break-before: always; /* Use if your last page is blank, else omit. */

@page {
   @bottom-right {
       content: "Please turn over";

@page lastPage {
    @bottom-right {
        content: none;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .