{"id":2283,"date":"2010-07-05T15:31:29","date_gmt":"2010-07-05T10:31:29","guid":{"rendered":"http:\/\/www.chiragmehta.info\/chirag\/?p=2283"},"modified":"2010-07-05T15:36:31","modified_gmt":"2010-07-05T10:36:31","slug":"page-break-page-number-and-page-layout-styles-in-visualforce-pdf-templates","status":"publish","type":"post","link":"https:\/\/www.chiragmehta.info\/chirag\/2010\/07\/05\/page-break-page-number-and-page-layout-styles-in-visualforce-pdf-templates\/","title":{"rendered":"Page Break, Page number and Page layout Styles in Visualforce PDF Templates"},"content":{"rendered":"<p><strong>1. Page Break<\/strong><br \/>\nWhile generating PDF template from Visualforce, if you want to give the page break ,below code snippet is very useful.<br \/>\nYou can use the  page break  style properties to control where the browser will insert a page break. The Force.com PDF content converter will carry that over to the PDF.<\/p>\n<blockquote><p><code>&lt;apex:page renderas=\"pdf\"&gt;<br \/>\n&lt;div style=\"page-break-after:always;\"&gt;<br \/>\nThis is page one<br \/>\n&lt;\/div&gt;<br \/>\n&lt;\/apex:page&gt;<\/code><\/p><\/blockquote>\n<p><strong>2. Page layout and Page number<\/strong><br \/>\nThe following snippet shows you have to switch the PDF  page layout to landscape and add page numbers to your Visualforce page. Use the below code in CSS of Visualforce page.<\/p>\n<blockquote><p><code>@page {<br \/>\n\/* Landscape orientation *\/<br \/>\nsize:landscape;<\/code><br \/>\n\/* Put page numbers in the top right corner of each page in the pdf document. *\/<br \/>\n@top-right<br \/>\n{<br \/>\ncontent: &#8220;Page &#8221; counter(page);<br \/>\n}<br \/>\n}<\/p><\/blockquote>\n<p>Source : Kyle Roche \/ Pragya Kumari<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. Page Break While generating PDF template from Visualforce, if you want to give the page break ,below code snippet is very useful. You can use the page break style properties to control where the browser will insert a page break. The Force.com PDF content converter will carry that over to the PDF. &lt;apex:page renderas=&#8221;pdf&#8221;&gt; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[169],"class_list":["post-2283","post","type-post","status-publish","format-standard","hentry","category-salesforce","tag-salesforce","post-preview"],"_links":{"self":[{"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/posts\/2283","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/comments?post=2283"}],"version-history":[{"count":6,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/posts\/2283\/revisions"}],"predecessor-version":[{"id":2289,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/posts\/2283\/revisions\/2289"}],"wp:attachment":[{"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/media?parent=2283"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/categories?post=2283"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chiragmehta.info\/chirag\/wp-json\/wp\/v2\/tags?post=2283"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}