Skip to main content

Posts

Showing posts from May, 2010

Generate PDF in Landscape mode

Most of us would have generated PDFs out of visualforce pages, but most of us would be facing issues with styling the PDF pages. Especially when it comes to changing the orientation of the pages.  I saw somewhere how to do it and thought that it should be shared so that everyone out there can use this simple mechanism to achieve this. Its no trick, but one of a very less known CSS feature. @page directive. Using @page directive you can control a lot of properties of the PDF document that you generate. For e.g. you can set  orientation to Landscape (default is Portrait).  margins of page page number Example code:- @page {         size:landscape;         margin:0.1cm 0.3cm 0.1cm 0.3cm;     } To know more about it and explore it, read this informative article on W3schools site ( http://www.w3.org/TR/css3-page/ ) If anybody faces any challenge, do let me know? At least I can look into it :)