| 
		
	 | 
	
	
	
		Rank: Member Groups: Member
 
 
Joined: 9/12/2013 Posts: 11 
	 | 
		   
	     
		    Hi, I have an MVC3 project and the current versions of EO.PDF.dll (5.0.34.2), EO.Pdf.Mvc.dll (5.0.34.2) and EO.PDF.Mvc3.dll (5.0.34.2) added as references.
  I'm using the [RenderAsPDF] attribute on one of the methods in my controller but the PDF is created in 'portrait' orientation (i.e. the width is less than the height) and I don't know how to manipulate this. I tried doing this:
          protected override void OnResultExecuted(ResultExecutedContext filterContext)         {             base.OnResultExecuted(filterContext);
              HtmlToPdfResult result = MVCToPDF.Result;             if (result != null)             {                 result.PdfDocument.Pages[0].Size.Height = PdfPageSizes.A4.Width;                 result.PdfDocument.Pages[0].Size.Width = PdfPageSizes.A4.Height;                 result.PdfDocument.Save(string.Format("c:\\mydownloads\\{0}", MVCToPDF.ResultFileName));             }
          } 
  but the page size properties are unaffected by my attempt to change them.
  Is there a way to do this?
  Thanks!
		 
	 | 
 | 
	
	
	
		Rank: Administration Groups: Administration
 
 
Joined: 5/27/2007 Posts: 24,427 
	 | 
		   
	    
		    Hi, Please try to do this and see if it works:
 
    
        Code: C#
         
        HtmlToPdf.Options.PageSize = 
    new SizeF(PdfPageSizes.A4.Height, PdfPageSize.A4.Width); 
     
 
Inside your action method (where you apply RenderAsPDF attribute). Thanks!
		  
	 | 
 | 
	
	
	
		Rank: Member Groups: Member
 
 
Joined: 9/12/2013 Posts: 11 
	 | 
		   
	     
		    Thanks - that's exactly what I needed :)
		 
	 | 
 | 
	
	
	
		Rank: Administration Groups: Administration
 
 
Joined: 5/27/2007 Posts: 24,427 
	 | 
		   
	     
		    Glad that it works for you. Please feel free to let us know if you have any more questions.
  Thanks!
		 
	 | 
 | 
	
	
	
		Rank: Member Groups: Member
 
 
Joined: 9/12/2013 Posts: 11 
	 | 
		   
	    
		    eo_support wrote:Please feel free to let us know if you have any more questions.
   OK :) In the same context as above, can I create text in the 'header' and 'footer' spaces of a PDF created in this way? e.g. Page 1 of 3, Customer Order Report, things like that? I don't need images or any formatting. Thanks!
		  
	 | 
 | 
	
	
	
		Rank: Administration Groups: Administration
 
 
Joined: 5/27/2007 Posts: 24,427 
	 | 
		   
	    
		    Hi, You would just call ConvertHtml again inside your action class's OnResultExecuted. That's when you can do "post process" with your files. You would do something like this:
 
    
        Code: C#
         
        //Set the output area
HtmlToPdf.Options.OutputArea = .....
//Render some HTML to the first page
HtmlToPdf.ConvertHtml("header", MVCToPDF.Result.PdfDocument.Pages[0]); 
     
 
This would allow you to add anything anywhere on an existing page. Thanks!
		  
	 | 
 | 
	
	
	
		Rank: Member Groups: Member
 
 
Joined: 9/12/2013 Posts: 11 
	 | 
		   
	    
		    eo_support wrote:Hi, You would just call ConvertHtml again inside your action class's OnResultExecuted. That's when you can do "post process" with your files. You would do something like this:
 
    
        Code: C#
         
        //Set the output area
HtmlToPdf.Options.OutputArea = .....
//Render some HTML to the first page
HtmlToPdf.ConvertHtml("header", MVCToPDF.Result.PdfDocument.Pages[0]); 
     
 
This would allow you to add anything anywhere on an existing page. Thanks!  Thank you for the speedy response - top class customer service! :)
		  
	 | 
 | 
	
	
	
		Rank: Administration Groups: Administration
 
 
Joined: 5/27/2007 Posts: 24,427 
	 | 
		   
	     
		    Glad to hear that. You are very welcome!
		 
	 | 
 |