November 8, 2004 at 8:30 am
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
November 8, 2004 at 5:07 pm
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();
November 9, 2004 at 8:32 am
You can also try Data Driven Subscription.
November 9, 2004 at 1:43 pm
Great, thanks you 2. Will try it out!
Skål - jh
November 9, 2004 at 3:05 pm
Also found this third party soft ware independent of Reporting Services.
pretty cool I thought
Skål - jh
January 26, 2005 at 4:41 am
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
January 26, 2005 at 4:43 am
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