28 Dec Some PDF tricks on Visualforce: Landscape, A4, page number and more
The beauty of Visualforce is simplicity. Remember when you were told the entire page renders as PDF if you just add renderAs=PDF to the Page tag.
Here is the trick, to render a page as PDF, we add a simple attribute to the <apex: page> tag
This will render the entire page as PDF.
Now, say we need to add some extra features to the PDF. Like a page number in the footer or we need to render the page in landscape mode. To perform these tricks simply add the following code to your visualforce PDF page and see it bend to your command.
1. Rendering page as landscape
2. Rending page in different size
3. Rendering page in landscape A4
4. Adding stuff in footer of the page
5. Adding page number to the page
The other variations in box-model are top-left, top-center, top-right, bottom-left, bottom -right, bottom – center.
Hope this helps creating those awesome looking PDFs in visualforce.