Link转SSRS报告直接下载PDF

Link to SSRS report to directly download PDF

我是否可以将查询字符串参数传递给 SSRS 报告,从而直接下载报告(最好是 PDF 格式)而不是让浏览器导航到报告?

我已使用 PowerShell 脚本完成此操作。关键是把&rs:Format=PDF传给URL。 Microsoft Reference

#set SSRS variables
$exportPath = 'C:\Temp\';
$ssrsPath = 'http://YourReportServer/ReportServer/Pages/ReportViewer.aspx?%2fYour%20Report%20Folder/Your%20%20Report';
$ssrsFileName = $ssrsPath.split('/')[-1] -replace '%20', ' ';
$ssrsFile = $exportPath + $ssrsFileName + '.pdf';

#remove file if it already exists
if (Test-Path $ssrsFile) 
{
    Remove-Item $ssrsFile
}

#create pdf of SQL Server Reporting Services (SSRS) report
$ssrsFilePdf = $ssrsPath + '&rs:Format=PDF'
(Invoke-WebRequest -Uri $ssrsFilePdf -OutFile $ssrsFile -UseDefaultCredentials -TimeoutSec 240);

我终于找到了我要找的东西。

通过将以下查询字符串添加到 URL,SSRS 将以 PDF 格式而不是通过通常的界面提供报告。

&rs:Format=PDF

我假设所有其他必要的参数也应该在查询字符串中提供。