| « SQL CPU running at 100 percent on SCOM Reporting Server | FastCGI PHP on Windows 2008 » |
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.
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:
Code:
<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:
Code:
<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 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.
Code:
<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> |
17 comments
This post has 1 feedback awaiting moderation...


Appreciate your effort in spelling it out so simply.
However it is included in SQL 2008 Report Services. I have not yet looked into possible Letter to A4 differences with that one, but it should be possible in the same way as mentioned above I assume.
Any idea?
Note: This applies only if you have very few report parameters since URL length limit in SSRS is 256 characters.
All you have to do is add a textbox in the header area of the report, give some text value as "Export to PDF" and in the 'Action' section of the textbox select 'Go to URL' and give the URL expression as below
=Globals!ReportServerUrl + "?"
+ Globals!ReportFolder + "/"
+ Globals!ReportName + "&rs:Command=Render"
+"&rs:Format=PDF"
+"&rc:PageWidth=11 in"
+"&rc:PageHeight= 15 in"
+"&Param1=" + CStr(Parameters!Param1.Value)
+"&Param2=" + CStr(Parameters!Param2.Value)
The values for PageWidth and PageHeight can be made even more dynamic by getiing it from an internal Parameter which can be varied based on some condition in the report, then the URL expression will look like
=Globals!ReportServerUrl + "?"
+ Globals!ReportFolder + "/"
+ Globals!ReportName + "&rs:Command=Render"
+"&rs:Format=PDF"
+"&rc:PageWidth=" + CStr(Parameters!PDFPageWidth.Value) +"in"
+"&rc:PageHeight=" + CStr(Parameters!PDFPageHeight.Value) + "in"
+"&Param1=" + CStr(Parameters!Param1.Value)
+"&Param2=" + CStr(Parameters!Param2.Value)
You may also want to hide the text "Export to PDF" in the PDF genereated then in that case use another hidden parameter (it should be an hidden parameter and not an internal parameter) and then set the visibility of the text box to Show Hide based on an expression and give the paramter for its value parameter name,
then the URL expression will look like
=Globals!ReportServerUrl + "?"
+ Globals!ReportFolder + "/"
+ Globals!ReportName + "&rs:Command=Render"
+"&rs:Format=PDF"
+"&rc:PageWidth=" + CStr(Parameters!PDFPageWidth.Value) +"in"
+"&rc:PageHeight=" + CStr(Parameters!PDFPageHeight.Value) + "in"
+"&HideExporttoPDF=true"
+"&Param1=" + CStr(Parameters!Param1.Value)
+"&Param2=" + CStr(Parameters!Param2.Value)
thanks
If the text renders as a hyperlink (which it should since you have attached an action to it.) then it should work. Also this will not work in Preview mode, it works only after you deploy it to a report server
Please make sure if you have attached an action to the textbox by going to Text Properties then select 'Action' from left then select Go to URL' and enter the value as I mentioned previously.
Thanks,
Dipen
I did the change on the Data Warehouse server, IISRESET and restart SQL Reporting Services. Now I am checking the RMS but I don't see the two new options...
These are two different servers (DW1 and RMS1) did I miss a step?
Thanks,
Dom
Sorry I missed the comment Update 17 december 2009 on SQL 2008 version:
In the lines of code please use "PDFRenderer" in stead of "PDFReport
it works like a charm now.,..
Thanks,
DOm
The change works fine... BUT the report content remains the same it just have more blank on the right side of the page as it is in landscape instead of portrait !!! I was expecting the chart to expand on the landscape format to make it less crowdy within the 8" ... expanded to 11"
Thanks,
Dom
this is a change in the SSRS config file followed by an iisreset. If you than run another report you should be able to export it in those formats. Otherwise shoot me a private email and we'll see how to solve it.