Reporting Services Corrupted PDF files

  • Hi,

    I use the command line program rs.exe to create some exports in pdf format from a Reporting Services Server 2005. I sometimes have problems to open the export of one specific report. Acrobat Reader shows error 109, file corruption.

    I used the option -l 0 to ensure that no timeout occurs.

    I used the option -e mgmt2000 because I could not find the syntax for the new namespace in SSRS 2005.

    The other reports use the completely same settings and everythings works perfectly.

    This is the batch:

    rs -i D:\SSRS\Scripts\run_MyReport.rss -s http://myserver/reportserver -l 0 -e mgmt2000 -t -b

    And this is the input file (run_MyReport.rss):

    ' Export report to pdf format to the specified path under filePath and to the file which is specified under fileN

    Dim format as string = "PDF"

    Dim filePath as String = "D:\exports\Reports2Send\"

    Dim fileN as String = "MyReport"

    'Dim Datum as String = CString(Date)

    Dim fileName as String = filePath + fileN + ".pdf"

    Dim reportPath as String = "/MyFolder/MyReport"

    Public Sub Main()

        ' Prepare Render arguments

        Dim historyID as string = Nothing

        Dim deviceInfo as string = Nothing

        Dim showHide as string = Nothing

        Dim results() as Byte

        Dim encoding as string

        Dim mimeType as string = "application/pdf"

        Dim warnings() AS Warning = Nothing

        Dim reportHistoryParameters() As ParameterValue = Nothing

        Dim streamIDs() as string = Nothing

        'Windows Credentials were send to Reporting server service

        rs.Credentials = System.Net.CredentialCache.DefaultCredentials

          

        ' Report Parameters

        Dim parameters(0) As ParameterValue

        results = rs.Render(reportPath, format, _

            Nothing, Nothing, Nothing, _

            Nothing, Nothing, encoding, mimeType, _

            reportHistoryParameters, warnings, streamIDs)

        ' Open a file stream and write out the report

        Dim stream As FileStream = File.OpenWrite(fileName)

        stream.Write(results, 0, results.Length)

        stream.Close()

    End Sub

    'End of script

    Did anyone experience similar problems?

    Best regards,

    Stefan


    Kindest Regards,

    SK

  • Microsoft does not own PDF so maybe your command line code is not working and I don't think you need any code because all you need is PDF reader and one click to export to PDF.  This is assuming you have done all the formatting needed to export to PDF, that is just setting properties and printing test pages.  Hope this helps.

     

     

     

    Kind regards,
    Gift Peddie

  • Hi,

    I know that PDF is a format from Adobe. But reporting services has a rendering extension to export to pdf.

    I have to export the report programmatically for customer reasons. I cannot use a subscription because of security reasons.

    I have to use rs.exe.

    Do you know any special formattings in Reporting Services which could cause the corruption, or someone else?

     

    Any help is appreciated,

    Stefoon


    Kindest Regards,

    SK

  • I don't think that is possible when a customer ask for something you cannot do you have to show why you cannot do it and sometimes they will accept the existing solution.  I had a problem with export to PDF adding an extra page I spent three days trying to fix it but it did not work because I had 15 invisible images in the report so PDF will not remove the extra page.  The customer accepted it as is.  Try the two links below for page setting issues and the reportiewer control which may help you convert the report to either Winform or Webform.

    http://blogs.msdn.com/bwelcker/archive/2005/08/19/Alien-Lanes-_2800_Logical-and-Physical-Pagination-Rules_2900_.aspx

    http://www.gotreportviewer.com/

    Kind regards,
    Gift Peddie

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply