Friday, February 26, 2016

Getting SSRS Charts to export to a shared file folder

We have a system here at the office that displays .jpg's on screens throughout the organization.  We use this to communicate goings on to people that are traveling through the breakrooms and hallways of the building.  Recently we wanted to show some SSRS reports on these screens.  The problem is that the devices that display the images do not use any sort of authentication and cannot tie into our SharePoint farm.  I had to figure out how we could produce a .jpg/.png file from a report and drop it into a file folder on the network.

This is not something you need everyday, but for those that need it, here is how I did it.

Firstly, my SharePoint/SSRS installation did not even have the option to export to a jpeg, so I relied on the below to get that working.

http://social.technet.microsoft.com/wiki/contents/articles/20825.ssrs-how-to-add-jpeg-and-png-report-export-when-ssrs-2012-is-integrated-with-sharepoint-2013.aspx


SQL Server Reporting Services (SSRS) does not include export to JPEG or PNG in the SharePoint report viewer web part by default,  even though SSRS supports report rendering in these formats.  For standalone SSRS servers you can enable this capability by editing the RSReportServer.config file (http://technet.microsoft.com/en-us/library/ms157273.aspx#bkmk_rendering This link is external to TechNet Wiki. It will open in a new window. ), but this does not work for SSRS integrated with SharePoint.

1. Get your application ID (GUID):    
Get-SPRSServiceApplication
2. Add the extensions:
New-SPRSExtension -identity "{INSERT YOUR APPLICATION ID HERE}" -ExtensionType "Render" -name "JPEG" -TypeName "Microsoft.ReportingServices.Rendering.ImageRenderer.ImageRenderer,Microsoft.ReportingServices.ImageRendering" -ServerDirectives "<OverrideNames><Name
 Language='en-US'>JPEG</Name></OverrideNames>" -ExtensionConfiguration "<DeviceInfo><OutputFormat>JPEG</OutputFormat></DeviceInfo>"            
 New-SPRSExtension -identity "{INSERT YOUR APPLICATION ID HERE}" -ExtensionType "Render" -name "PNG" -TypeName "Microsoft.ReportingServices.Rendering.ImageRenderer.ImageRenderer,Microsoft.ReportingServices.ImageRendering" -ServerDirectives "<OverrideNames><Name
 Language='en-US'>PNG</Name></OverrideNames>" -ExtensionConfiguration "<DeviceInfo><OutputFormat>PNG</OutputFormat></DeviceInfo>"
3. You can list the loaded Render extensions:
Get-SPRSExtension -Identity "{INSERT YOUR APPLICATION ID HERE}" -ExtensionType "Render"
4: If you make a mistake you can remove them with:
Remove-SPRSExtension -Identity "{INSERT YOUR APPLICATION ID HERE}" -ExtensionType "Render" -Name PNG

Secondly, the report was not saved in a format that fit the screen.  I had to go into the report and fiddle with the page setup options to align the print out to fit the screen.  This is something you will need to do when building the report.

Finally, you will need to set up a subscription via "Manage Subscriptions" on the report in SharePoint.  In this area you need to give it the location where you will save your .jpg or .png.  

This is where it got tricky.
Even though the person running the report had full access to both the library in SharePoint and the folder on the network, we still got a permissions error when the subscription ran.

It ends up that the account running the report needs local log in rights on the SharePoint server running the SSRS service to perform the action we are attempting.  We didn't want to allow anyone trying to run a report to do this access to the server, so we created a service account that had these rights and used that account to run the subscription.  We also gave the service account full permissions on the folder we were writing the .jpg to out on the network.