[SalesForce] Render Visualforce page as PDF in landscape orientation

I've done it before but recently it does not appear to be working. Tried changing the api to an older version, still nothing. Not sure what else to try. i've tried multiple 'solutions' from other related posts, but they all seem to be from 2015 and earlier, back when those solutions worked for me. Anyone know what has been changed and how to accomplish this currently? The most recent post I found suggested this:

@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; 

              }  

But that doesn't work either. here is a snippet of what I have now:

<apex:page StandardController="Opportunity" Extensions="ProjectInformationExt" renderas="pdf">

<apex:includeScript value="{!$Resource.JqueryMin}" />
<apex:includeScript value="{!$Resource.Project_Info_Scripts}" />
<apex:includeScript value="{!$Resource.ClearanceScripts}" />
<apex:stylesheet value="{!$Resource.ClearanceStyle}" />
<apex:stylesheet value="{!$Resource.DipStyle}" />
<apex:stylesheet value="{!$Resource.RFC_ViewAsReport}" />
<head>
<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; 

          }  
    .label{
        font-size: 13px;
        color: #000;
    }
</Style></head>
<span class="hidden" id="pid">{!project.id} </span> 
<apex:image url="{!$Resource.OPICLogo}" width="50" height="50"
    style="float: left;" />
<h2 class="text-left" style="float: left; color: black;">
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <apex:outputField value="{!project.name}" />
</h2>
<br style="clear: both;" />
<br style="clear: both;" />

<div class="bold text-right" style="float: right;">
    <table>
        <tr>
            <td class="nopad">Report Date:&nbsp;<apex:outputText id="outDate" value="{!currentDate}" />
            </td>
        </tr>
    </table>
</div>
<!--<apex:outputText value="{!findip.id}"/>-->
<div class="bold text-right" style="clear: both; float: right;">

    Project Information for&nbsp;
    <apex:outputField value="{!project.ProjectID__c}" />
    <br />
</div>
<br/>

Best Answer

You have to use applyBodyTag="false" attribute in <apex:page tag as explained in Visualforce Developer Guide to render the PDF properly. I checked with the below code and I am able to render the PDF in landscape mode.

<apex:page standardController="Account" renderAs="pdf" applyBodyTag="false">
    <head>
        <style>
            @page{
                size: A4 landscape;
            }            
            body {
                font-family: 'Arial Unicode MS';
            }
            .companyName {
                font: bold 30px; color: red;
            }  
        </style>
    </head>
    <body>
        <center>
        <h1>New Account Name!</h1>

        <apex:panelGrid columns="1" width="100%">
            <apex:outputText value="{!account.Name}" styleClass="companyName"/>
            <apex:outputText value="{!NOW()}"></apex:outputText>
        </apex:panelGrid>
        </center>
    </body>
</apex:page>