You need to sign in to do that
Don't have an account?
vikramraj muthayala
Reset Page Number in PDF generated using Visual force
Can we count page Number based on <apex:repeat> tag.
Say example visual force generates PDF from list button where 2 records are selected and result page is totally 5.
With help apex repeat tag, for the first record 3 pages and second record it is next 2 pages generated in a single file.
I want count a page number in a PDF doc as Page 1 of 3, 2 0f 3, 3 0f 3 and then again 1 of 2 and 2 of 2.
Is it possible? I am using below code to display page number it is counting from 1 to 5.
how to reset for the second record
<HEAD> <style type="text/css"> @page { @bottom-center{ content: "Page " counter(page) " of " counter(pages); } } } </style> </HEAD>
Say example visual force generates PDF from list button where 2 records are selected and result page is totally 5.
With help apex repeat tag, for the first record 3 pages and second record it is next 2 pages generated in a single file.
I want count a page number in a PDF doc as Page 1 of 3, 2 0f 3, 3 0f 3 and then again 1 of 2 and 2 of 2.
Is it possible? I am using below code to display page number it is counting from 1 to 5.
how to reset for the second record
<HEAD> <style type="text/css"> @page { @bottom-center{ content: "Page " counter(page) " of " counter(pages); } } } </style> </HEAD>
If it need to controlled through controller, how can we do it ? how can we know how much content as single page will hold.
below is the code:
<apex:page standardController="Account" extensions="AccController" showHeader="false"
applyHtmlTag="false" standardStylesheets="false" cache="true" readOnly="true"
renderAs="pdf">
<head>
<style type="text/css" media="print">
@page
{
margin-top: 13%;
margin-bottom: 18%;
margin-right: 5%;
margin-left: 5%;
size: A4;
@top-center
{
content: element(header);
}
@bottom-left
{
content: element(footer);
}
}
div.header
{
valign : top;
padding: 5px;
position: running(header);
}
div.footer
{
display:block;
position: running(footer);
}
.pagenumber:before
{
content: counter(page);
}
.pagecount:before {
content: counter(pages);
}
</style>
</head>
<div class="header">
<!-- Header Content -->
</div>
<div class="footer">
<div align="right" style="width:95%; font-family: sans-serif;font-size:12px;">
Page <span class="pagenumber"/> of <span class="pagecount"/>
</div>
</div>
<apex:repeat value="{!ReportInfo}" var="rpt">
<div id="end" style="page-break-after:always;">
Content Details goes here
</div>
</apex:repeat>
</apex:page>