2

I've been looking everywhere and trying lots of things (going back to version 28 and older, using doctype="html-5.0" and more.), and I can't seem to get the landscape orientation to trigger when rendering as a PDF.

What am I doing wrong? (somewhat Redacted). Any help is appreciated!!

<apex:page standardController="Appeal_Review__c" extensions="EXTENSION1, EXTENSION2" showHeader="false" renderAs="pdf" applyBodyTag="false" applyHtmlTag="false">
<!-- <Apex:pageblock title="Export Results"> -->
<html>
    <head>
        <style>

            @page {

            size: landscape;
            margin: 25mm;
            @top-center {
            content: "Sample";
            }
            @bottom-center {
            content: "Page " counter(page) " of " counter(pages);
            }
            }
            .page-break {
            display:block;
            page-break-after:always;
            }
            body {
            font-family: Arial Unicode MS;-->
            }
        </style>
    </head>
    <body>
        <div style ="page-break-before:always">
            <table width = "100%">
                <tr>
                    <td align="center" height="30" valigh="center"><b><i> Search Results </i></b></td></tr>
            </table>
            <table width="100%" height="10"><tr><td></td></tr></table>
            <table width="100%" border="1" cellpadding="5">
                <tr>
                    <th align="center" width="10%">column 1</th>
                    <th align="center" width="10%">2</th>
                    <th align="center" width="50%">3</th>
                    <th align="center" width="30%">4</th>
                </tr>
                <apex:repeat value="{!VARIABLE}" var="c">
                    <tr>
                        <td align="center">{!c.SOMETHING}</td>
                    </tr>
                </apex:repeat>
            </table>                                      
        </div>     
    </body>
</html>

2

Please try to use below code snippet

 <style>
            @page {  
                     size: A4 landscape; /* ISO/JIS A4 (210mm�297mm) */  
                     margin: 5mm; 
                  } 
            @page:first {  
                     size: A4 landscape; /* ISO/JIS A4 (210mm�297mm) */ 
                     margin: 5mm; 
                     margin-top: 3mm; 

                  }  
</style>
  • Oh that works great - though only for the first page. The other pages are not in landscape. How would you apply landscape for all PDF pages? – RC82 Jul 8 '15 at 14:21
  • it would work for all pages as well. try with removing second styling then it will be applied for all pages. – Ankuli Jul 8 '15 at 14:26
  • oops, nevermind, I had a typo in there. Works great, thank you! – RC82 Jul 8 '15 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.