2

i am trying to create a VF which will render as PDF.in header instead of Only Page Number i want also Date.my pdf header is

<div><h1>Project Roadmap </h1>
 Date: {!Day(today())}.{!Month(today())}.{!YEAR(today())}
 Page: "Page " counter(page) " of " counter(pages)
 </div>

counter is a css method not of html.i want current date as well as current page number.Is there any alternative of counter method.or any other possible solution ?? please guidekline

4

CSS includes special features to handled paged media (such as PDF pages) as described in e.g. Paged media and CSS Paged Media Module Level 3. (How many of theses feature's Salesforce's current PDF generation supports can probably only be established by trial and error.)

You can't put page numbering in the normal page content because you can't predict where the page breaks are going to be.

This will output today's date at the bottom left of each page and the page number at the bottom right of each page:

<apex:page renderAs="PDF" applyBodyTag="false">
<head>
<style type="text/css">
@page {
    @bottom-left {
        content: "Date {!DAY(TODAY())}.{!MONTH(TODAY())}.{!YEAR(TODAY())}";
        font-family: sans-serif;
        font-size: 80%;
    }
    @bottom-right {
        content: "Page " counter(page) " of " counter(pages);
        font-family: sans-serif;
        font-size: 80%;
    }
}
</style>
</head>
<body>
...
</body>
</apex:page>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.