SQL Reporting Services Render PDF in A4 paper size instead of Letter

 
Update 17 december 2009: This procedure was written on SQL 2005. For SQL 2008 I have added some lines at the bottom of the post, so if you are on 2008 please also check there before applying and it will work for you as well.
End of update.

Update 9 ocotber 2012: For SQL 2012, please follow the steps for SQL 2008 mentioned in this article.
End of update.

Everywhere I come to deploy SCOM a common question is to get lots of reports out of it. However after creating the reports and scheduling them for delivery it mostly stops. However as soon as somebody tries to print the reports the printers usually hang asking for Letter size paper.

The default behavior for the PDF rendering in SQL Reporting Services is to render it to Letter paper size. So how to get it to render to A4 paper size?

After some searching with a DBA colleague of mine we came across some MSDN pages explaining the options to create custom rendering options.

What to do:
On your reporting server go to the Rsreportserver.config file located in the reportserver directory. In my case this was at C:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\ReportServer . We need to edit this file, so open it with Notepad or something like that (something that does not break up the XML formatting in the file).

Scroll down to the section starting with Render.

You will see entries like this:


      <extension Name="IMAGE" Type="Microsoft.ReportingServices.Rendering.ImageRenderer.ImageReport,Microsoft.ReportingServices.ImageRendering">
      <extension Name="PDF" Type="Microsoft.ReportingServices.Rendering.ImageRenderer.PdfReport,Microsoft.ReportingServices.ImageRendering">

What we want to do here is for instance add a custom PDF extension. So here goes. Create some space below the PDF entry and paste something like the following:


<Extension Name="PDF (A4 Landscape)" Type="Microsoft.ReportingServices.Rendering.ImageRenderer.PdfReport,Microsoft.ReportingServices.ImageRendering">
        <OverrideNames>
            <Name Language="en-US">PDF in A4 Landscape</Name>
        </OverrideNames>
        <Configuration>
            <DeviceInfo>
                <OutputFormat>PDF</OutputFormat>
                <PageHeight>8.27in</PageHeight>
                <PageWidth>11.69in</PageWidth>
            </DeviceInfo>
        </Configuration>
</Extension>
<Extension Name="PDF (A4 Portrait)" Type="Microsoft.ReportingServices.Rendering.ImageRenderer.PdfReport,Microsoft.ReportingServices.ImageRendering">
        <OverrideNames>
            <Name Language="en-US">PDF in A4 Portrait</Name>
        </OverrideNames>
        <Configuration>
            <DeviceInfo>
                <OutputFormat>PDF</OutputFormat>
                <PageHeight>11.69in</PageHeight>
                <PageWidth>8.27in</PageWidth>
            </DeviceInfo>
        </Configuration>
</Extension>

This adds two entries to your report server export drop down list.
Rules:
– make sure your name is unique (Extension name).
– The overridename entry is what you see in the drop down list.
– pageheight and pagewidth must be defined in Inches like in the example above.
– A4 is defined mostly as 8.3in x 11.7in , but in some cases the result is better when using 8.27in x 11.69 in.

Save the file and immediately you can use these formats. No restarting of services needed here if you are on the SQL 2005 version.
Good luck!

Original page on MSDN covering the topic.

Update 9 october 2013 on SQL 2012 version:
Use the below code and method mentioned for SQL 2008 also for SQL 2012.

Update 17 december 2009 on SQL 2008 version:
In the lines of code please use “PDFRenderer” in stead of “PDFReport”. Also you must restart IIS on the box before it will show in reporting services. This is the difference with the 2005 version.
Thanks to Peter Yang from Microsoft for pointing out these changes.

As it seems to be case sensitive I just placed the SQL 2008 Reporting Services code block below for you to cut and paste.


<Extension Name="PDF (A4 Landscape)" Type="Microsoft.ReportingServices.Rendering.ImageRenderer.PDFRenderer,Microsoft.ReportingServices.ImageRendering"> 
         <OverrideNames> 
             <Name Language="en-US">PDF in A4 Landscape</Name> 
         </OverrideNames> 
         <Configuration> 
             <DeviceInfo> 
                 <OutputFormat>PDF</OutputFormat> 
                 <PageHeight>8.27in</PageHeight> 
                 <PageWidth>11.69in</PageWidth> 
             </DeviceInfo> 
         </Configuration> 
 </Extension> 
<Extension Name="PDF (A4 Portrait)" Type="Microsoft.ReportingServices.Rendering.ImageRenderer.PDFRenderer,Microsoft.ReportingServices.ImageRendering"> 
         <OverrideNames> 
             <Name Language="en-US">PDF in A4 Portrait</Name> 
         </OverrideNames> 
         <Configuration> 
             <DeviceInfo> 
                 <OutputFormat>PDF</OutputFormat> 
                 <PageHeight>11.69in</PageHeight> 
                 <PageWidth>8.27in</PageWidth> 
             </DeviceInfo> 
         </Configuration> 
 </Extension>

Comments are closed.