+ Start a Discussion
Salesforce 283Salesforce 283 

Display header images in all pages in PDF

Hi Guys,

  I need to display header images which is full width image that apply all pages in PDF. Styles are not working when styles write in page itself. So i wrote in static resource and please help me out this problem.
Alexander TsitsuraAlexander Tsitsura
Hi,

You can create head tag and put there styles.
<apex:page showHeader="false" sidebar="false" applyBodyTag="false" applyHtmlTag="false" renderAs="pdf">
	<head>
        <style>
            @page {
                @top-center {
                    content: "HEADER_TEXT";
                    background-image: url('{!$Resource.YOUR_IMAGE}');
                }
                @bottom-center {
                    content: "Page " counter(page) " of " counter(pages);
                }
            }
        </style>
	</head>
    <body>
       ...
    </body>
</apex:page

As a common practice, if your question is answered, please choose 1 best answer. 
But you can give every answer a thumb up if that answer is helpful to you.

Thanks,
Alex