Programmatic Saving of SSRS Reports Creating Damaged PDFs

时间:2015-06-30 13:55:20

标签: sql-server vba pdf reporting-services ssis

I have created an SSIS package that is supposed to run an SSRS report from the Report Server and generate PDF's accordingly. Currently, there are two main issues:

  1. The PDF files are all 52 KB in size (they should vary from 250-300 KB)

  2. The PDF files that are generated cannot be opened because they are "either not a supported file type or because the file has been damaged."

Below is my VB script task that does the actual work. I have verified that I have the proper connections established in my Connection Manager, that the URL I am using to reference the SSRS report is correct, and the SSRS report itself doesn't have any errors. Any thoughts?

Imports System    
Imports System.Data    
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime

    Enum ScriptResults
        Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success
        Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
    End Enum


    Public Sub Main()
        Dim httpConn As ConnectionManager = Dts.Connections("ReportServer")
        Dim clientConn As HttpClientConnection = New HttpClientConnection(httpConn.AcquireConnection(Nothing))
        Dim ReportFilename As String = "path\" & Dts.Variables("User::Dealers").Value & ".pdf"
        clientConn.ServerURL = "http://url"
        clientConn.DownloadFile(ReportFilename, True)
        Dts.TaskResult = ScriptResults.Success
        Dts.TaskResult = ScriptResults.Success
    End Sub    
End Class

0 个答案:

没有答案