1

In the code below, I want to include the account name in the left footer dynamically. If I have {!account.name} in the left footer, nothing displays there. If I do not include {!account.name} I see the other text there. How can I include a dynamic value from the controller in the footer?

@page { 
            @bottom-right { 
                content: "Page " counter(page) " of " counter(pages); 
                font-size: 8pt; 
                color: #838383;
                margin-bottom: 20px;
            } 
            @bottom-left { 
                content: "Proprietary and Confidential {!account.name}";
                font-weight: lighter; 
                font-size: 8pt; 
                color: #838383;
                margin-bottom: 20px;
            } 
        }

Thanks.

2
  • Is this CSS part of VF page, and is it inside of the apex:form tag?
    – kurunve
    Commented Aug 2, 2019 at 17:39
  • CSS is in the <style> part of the <header>. This is a pdf, so no form tag.
    – Jim hyland
    Commented Aug 2, 2019 at 17:57

1 Answer 1

1

If your account name has any special characters aside from A-Z and 0-9, it may not render correctly. Use HTMLENCODE to make sure this doesn't happen:

content: "Proprietary and Confidential {!HTMLENCODE(account.name)}";
6
  • I ended up doing this in a <div>. I am now trying to add a little space below the footer. Neither changing the padding or margin, or <br/>'s have any effect. How can add a little space between the footer and the bottom of the page?
    – Jim hyland
    Commented Aug 2, 2019 at 18:52
  • @Jimhyland I'm not sure you can do this, actually. Have you tried finding a Code Pen example?
    – sfdcfox
    Commented Aug 2, 2019 at 19:02
  • I was able to do this using the margin-bottom on the @page.
    – Jim hyland
    Commented Aug 2, 2019 at 19:08
  • What is Code Pen?
    – Jim hyland
    Commented Aug 2, 2019 at 19:09
  • @Jimhyland Code Pen is a site where people build example HTML, CSS, and JS, then share it with the world. I usually go there to find specific snippets for something I'm trying to do but can't puzzle out.
    – sfdcfox
    Commented Aug 2, 2019 at 19:11

You must log in to answer this question.

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