You need to sign in to do that
Don't have an account?
Steve Berley
Generating a PDF - want to change the page footer from within a loop
Hi -
I have a VF page that generates what we call Route Sheets. Each one takes 1-2 pages and the whole printout is about 55 pages long. Each Route starts on a new page. This is all fine.
The challenge is -- I'd like to include the route name on every page so was thinking of placing it in the page footer. To accomplish this I'd need to change the footer with each iteration through the loop.
Can that be done? If not, do you have other suggestions?
Thanks,
Steve
I have a VF page that generates what we call Route Sheets. Each one takes 1-2 pages and the whole printout is about 55 pages long. Each Route starts on a new page. This is all fine.
The challenge is -- I'd like to include the route name on every page so was thinking of placing it in the page footer. To accomplish this I'd need to change the footer with each iteration through the loop.
Can that be done? If not, do you have other suggestions?
Thanks,
Steve
<apex:page controller="GenerateRouteSheets" deferLastCommandUntilReady="true" renderAs="PDF" applyBodyTag="false" action="{!loadData}"> <!-- <apex:page controller="GenerateRouteSheets" deferLastCommandUntilReady="true" renderAs="PDF" applyBodyTag="false" > --> <head> <style> @page{ size: landscape; @bottom-right { font-family: 'Arial Unicode MS'; font-size: 13px; content: "Page " counter(page) " of " counter(pages); } } </style> </head> <script> var dt = new Date(); document.getElementById("datetime").innerHTML = dt.toLocaleString(); </script> <body> <apex:pageBlock > <apex:repeat value="{!routes}" var="r"> <div style="page-break-after:always; "> Route {!r} ~~ SNIP ~~ </div> </apex:repeat> </apex:pageBlock> </body> </apex:page>
The underlying PDF generator used by Salesforce is (was?) FlyingSaucer (difficult to know all the kept features by Salesforce).
https://flyingsaucerproject.github.io/flyingsaucer/r8/guide/users-guide-R8.html
CSS running elements seem to work included inside a loop in my first test (must be confirmed by your test).
All Answers
The underlying PDF generator used by Salesforce is (was?) FlyingSaucer (difficult to know all the kept features by Salesforce).
https://flyingsaucerproject.github.io/flyingsaucer/r8/guide/users-guide-R8.html
CSS running elements seem to work included inside a loop in my first test (must be confirmed by your test).
Thanks a bunch my friend!
I have struggled greatly with a PDF generated with a VFP recently at work with exactly the same problems (not easy to find the combination that works finally, a rather undocumented feature, not your problem for this idea but I also struggled with this one: https://success.salesforce.com/ideaView?id=0873A000000lKdPQAU "If that is the case would be great if Salesforce can document it" ... there is a workaround that works )