VF / HTML markup for RenderAs PDF a specific div that spans 1+ pages in landscape mode

I’m exporting some reports using renderAs="pdf" and working fine. I need to add a summary page for those reports(no matter at the beginning or at the end) in landscape mode. I used @page :first{size:landscape;} which is some what ok. But since the summary content can’t assumed to be in one page I’m looking for apply this to a <div />. Is this possible?

<div id="content ">
  //repeating content with page breaks and all working fine
</div>

<div id="summary">
  // this content need to be in landscape since more columns
</div>

Answer

Yes its Possible !!
All you need to do is ,add the following css in your style tag

 @page landScapeMode
 {
     size:landscape;
 }
#summary
{
    page:landScapeMode;    
}

So basically what I have done is I have made use of named page selectors!
Hope this helps !

Attribution
Source : Link , Question Author : highfive , Answer Author : Pavan

Leave a Comment