Skip to content

Instantly share code, notes, and snippets.

@xjsender
Last active December 24, 2015 10:06
Show Gist options
  • Select an option

  • Save xjsender/69d8aca23047a213d72f to your computer and use it in GitHub Desktop.

Select an option

Save xjsender/69d8aca23047a213d72f to your computer and use it in GitHub Desktop.
Visualforce PDF Landscape

Add page size for PDF rotation below v28.0

@page {
    size: landscape;
}

After v28.0, use below method:

<apex:page renderAs="pdf" applyHtmlTag="false" showHeader="false">
    <head>
        <style>
            @page {
                size: landscape;
            }
        </style>
    </head>

    <div>
        dsafdsafasfsafsafsfsfsafssa
    </div>
</apex:page>

None-english problem

<apex:page renderAs="pdf" applyHtmlTag="false" showHeader="false"> <style> @page { size: landscape; } </style>

<body style="font-family: Arial Unicode MS">
    <div>
        dsafdsafasfsafsafsfsfsafssa
    </div>
</body>

</apex:page>

Reference:

Render PDF as landscape issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment