Programatically render a PDF in reporting services

From tekkies.co.uk
Jump to: navigation, search

The SQL code below renders a report using the parameters you specify and saves it as a pdf on the disk.


master..xp_cmdshell 'C:\Curl\curl.exe --verbose --fail --NTLM 
--user username:password  
"http://myserver/ReportServer?/fodler/MyReport&rs:Format=PDF&MyParameterA=1&MyParameterB=5" 
--output D:\rendered\myreport.pdf 2> D:\rendered\MyReport.log.txt'

You can also render to other formats and adjust other rendering paramters. The example uses rs:Format=PDF, others are documented at http://technet.microsoft.com/en-us/library/ms152835.aspx