sql reporting services - batch pdf generation

  • Hey gang,

    Any one know a way to dynamically and automacially batch generate a mass of pdf files using reporting services?

    Investigating options for PDF generation in an app that uses SQL Server 2000.

    Much appreciated!

    Skål - jh

  • Here is a portion of C# code that I use to create a PDF in the user's temp directory. The string rsReport is the name of the report I'm about to process, and I also use that for the file name. . .

    ReportingService _rs = new ReportingService();

    _rs.Credentials = System.Net.CredentialCache.DefaultCredentials;

    string sOutputPath = Environment.GetEnvironmentVariable("TEMP");

    string encoding;

    string mimeType;

    ParameterValue[] parametersUsed;

    Warning[] warnings;

    string[] streamIds;

    //render the report

    byte[] data;

    data = _rs.Render("/" + rsReport, "PDF", null, null, parameters, null,

    null, out encoding, out mimeType, out parametersUsed, out warnings,

    out streamIds);

    //create a file stream to write the output

    string fileName = sOutputPath + "\\" + rsReport + ".PDF";

    // delete if previous file exists -

    // workaround if Acrobat hung & left a corrupted PDF

    try

    {

    File.Delete(fileName);

    }

    catch

    {

    }

    FileStream fs = new FileStream(fileName, FileMode.OpenOrCreate);

    BinaryWriter writer = new BinaryWriter(fs);

    writer.Write(data, 0, data.Length);

    writer.Close();

    fs.Close();

  • You can also try Data Driven Subscription.

  • Great, thanks you 2.  Will try it out!

    Skål - jh

  • Also found this third party soft ware independent of Reporting Services.

    pretty cool I thought

    http://www.dynamicpdf.com/

    Skål - jh

  • See a recent article here about the "rs" Tool. It describes your task for Excel files but should also be possible with PDF.

    Re

    Jörn

  • Sorry forgor the URL:

    http://www.sqlservercentral.com/articles/articlesexternal.asp?articleid=1681

    Re

    Jörn

Viewing 7 posts - 1 through 6 (of 6 total)

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