Formatting Problem when Reports are exported

Service Manager can be used to create Reports, either by creating them directly in the console or by using a schedule to automatically create reports based on a defined interval (see this blog post for more details). There are times when you want to export created reports in different formats, let’s say PDF. And this is the point where you could run into troubles. Some reports use a width (US letter) that does not fit on european A4 format. As a result you will get your PDF divided on 2 pages. Not really what you are looking for. But don’t worry, this blog post shows you how to solve this problem.

The Problem

This can happen when you export Reports to PDF. Not always, but sometimes.

image
(Page 1)

image
(Page 2)

The Solution

The solution to this problem is easy. You just have to define a new format that fits on regular A4. On the SQL Reporting Service change to the following directory –> c:\program files\microsoft sql server\msrs10.sqlserver\reporting services\reportserver\. Backup and then edit the file “rsreportserver.config”. Search for the section and past the following code to add two extensions:

<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>
<MarginBottom>0.2in</MarginBottom>
<MarginLeft>0.2in</MarginLeft>
<MarginRight>0.2in</MarginRight>
<MarginTop>0.2in</MarginTop>
</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>8.27in</PageHeight>
<PageWidth>11.69in</PageWidth>
<MarginBottom>0.2in</MarginBottom>
<MarginLeft>0.2in</MarginLeft>
<MarginRight>0.2in</MarginRight>
<MarginTop>0.2in</MarginTop>
</DeviceInfo>
</Configuration>
</Extension>

Caveat:Take care when copying the text. Maybe some special characters will not be copied correctly.

Important: When using SQL 2005 replace “PDFRenderer” with “PDFReport” (Type=….)

Afterwards, the file should look something like this:

image

After the modification, restart the SQL Reporting Service and reload the Service Manager Console or the Reporting Website (whatever you are using). Now when creating a new report or exporting a Report, you have the new formats available.

image
(Service Manager Console screenshot)

image
(Report Server Website screenshot)

When using the new format, the report fits exactly on A4 format. Great!

image

regards
Marcel

About Marcel Zehner

Microsoft Azure MVP
This entry was posted in SCSM and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s