+ Start a Discussion
michaellee.ampfmichaellee.ampf 

Visualforce PDF Page Orientations

Hi,

 

I know that I'm able to set page orientation for a VisualForce PDF document by having either

 

@page {
  size:portrait;

}

 

@page {
  size:landscape;

}

 

in the CSS file.  Now, what I'm wondering is if there is any way for me to have the first page of a PDF document in portrait, and the second page in landscape.  Is that possible?  Is it possible to set the style for a particular page?

 

Thanks,

Michael

Best Answer chosen by Admin (Salesforce Developers) 
michaellee.ampfmichaellee.ampf

Thanks --

 

As I dug through the web and CSS documentation, I was able to do something like this instead:

 

@page rotated {
  size:landscape;
  margin-top:10px;
  margin-right:10px;
  margin-left:10px;
  margin-bottom:20px;
}

table.history2
{
    page:rotated;
    width: 10in;
}

 

-- and additional placement of "page:rotated" got me exactly what I was looking for.

 

Thanks,

Michael

All Answers

Pradeep_NavatarPradeep_Navatar

You can use @page :first for first page and @page for rest of pages, see the eample below :

@page :first
{
 size:portrait;
}

@page
{
  size:landscape;
}

michaellee.ampfmichaellee.ampf

Thanks --

 

As I dug through the web and CSS documentation, I was able to do something like this instead:

 

@page rotated {
  size:landscape;
  margin-top:10px;
  margin-right:10px;
  margin-left:10px;
  margin-bottom:20px;
}

table.history2
{
    page:rotated;
    width: 10in;
}

 

-- and additional placement of "page:rotated" got me exactly what I was looking for.

 

Thanks,

Michael

This was selected as the best answer