April 12, 2005 at 10:04 am
It seems the most obvious thing that users of a reporting tool want to be able to do is print reports - on a printer. Yet this feature is something which does not seem to come as standard with RS. So far as I can see, you have to write an extension to RS to be able to do this. Admitedly, some sample code does come with the RS package, but it doesn't work too well off the bat. I know I can export the report and print it through PDF (but page orientatrion does not work properly), or Excel (pretty impressive, but page numbering doesn't work properly), or print the web page - but that's just silly when you have multiple pages.
Have I got it wrong? Have I missed something here? Someone please tell me it's there on the toolbar!
John
April 13, 2005 at 4:57 am
Sorry for the bad news but no you cant directly print. The reason for this is that the report is a thin client displayed in Internet explorer. Internet explorer has very limited page formatting available for printing. I have encountered multiple other examples where you need to format tables on web pages for printing but just cant do it nicely. That is why they let you export to pdf where you have extensive formatting for printing. If the report viewer was a active x control like the crystal report viewer activex, then you could code formatting into the activex. But then it wouldn't be a pure thin client report....
April 13, 2005 at 4:58 am
Yes, you're right, though you can write your own print rendering extension (apparently). Other than that use the PDF export. The version coming with SQL Server 2005 may well have one-click printing as a feature; the current version was added as something of an afterthought. Some features are of course interactive (document maps, drill-down and -through), but I agree, this is a big omission and will make it difficult to sell to end users.
As regards page orientation, just make sure you set the page width and height accordingly in the report properties.
April 13, 2005 at 6:24 am
I tried installing the Sample Printer Delivery Extension from RS, and did not worked the first time. But supposedly works, creating a new export method for RS, but instead sends the reendered report to a printer.
Has anybody tried this?
CM
April 13, 2005 at 8:15 am
Supposedly Reporting Services Service Pack 2 will provide an ActiveX control that will allow printing...
Supposedly available about April 24th...
Steven J. Ackerman, Consultant
ACS, Sarasota, Florida
http://spaces.msn.com/members/sjackerman
Steven J. Ackerman
Consultant
ACS, Sarasota, FL
http://www.acscontrol.com
http://spaces.msn.com/sjackerman
April 13, 2005 at 8:21 am
I tried many sets of bits before I found one that worked. I am using URL access to render the report to a file as a PDF and then launching Acrobat with a command-line to print the report on paper. . .
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();
/* Acrobat command-line to print a file:
* AcroRd32.exe /t "filename" "printer name" "driver name" "port name"
* we use PrinterSettings to get the name of the default printer, then use
* generic defaults for the driver and port
*/
string Q = '"' + " " + '"';
Process rsProcess = new Process();
rsProcess.StartInfo.FileName = "AcroRd32.exe";
rsProcess.StartInfo.Arguments =
" /t " + '"' + fileName + Q + prt + Q +
"Generic / Text Only" + Q + "/" + '"';
rsProcess.Start();
// adapted from Microsoft Knowledge Base Article - 305369
// Wait for a Shelled Application to Finish (with timeout)
rsProcess.WaitForInputIdle();
rsProcess.WaitForExit(timeOut);
if (rsProcess.HasExited == false)
if (rsProcess.Responding)
rsProcess.CloseMainWindow();
else
rsProcess.Kill();
April 13, 2005 at 4:49 pm
Things get even worse if you have a report that doesn't export to PDF or Excel because of an RS bug relating to matrix tables that have subtotals. Print options for these reports are limited to using the browser print functionality, which simply is not workable. Bring on the direct printing, I say!
April 13, 2005 at 5:14 pm
Thanks for all your contributions. Very interesting and similar conclusions to my own.
The problem I've found with the 'Export to PDF and print from there' option is that if I export a landscape report it seems to end up in portrait mode which, of course, truncates the report rows and screws the pagination. This may be because you can't seem to actually specify 'Landscape' or 'Portrait' options in the designer - just page sizes. Anyone know how to get the PDF option to recognise the orientation?
Also, has anyone tried writing an extension for printing? There's some example C# code that comes with RS which makes a stab at it but doesn't work very well from a formatting perspective (I haven't found time to try tightening it up yet). This method is slightly clunky anyway as you have to implement it as a new export medium (or set up a subscription or something).
No doubt the next version will bring improvements!
April 13, 2005 at 5:33 pm
One trick to getting PDF's looking good on paper is that you need to visit the Acrobat page setup dialogs:
Page scaling: fit to paper
Auto-rotate and center = checked
Choose paper source by PDF page size = checked
November 16, 2006 at 12:37 am
I noticed this thread was from 2005 - has this situation improved at all with the new release of srs ?
Thanks in advance
T
November 16, 2006 at 3:52 am
If you mean have things improved with later versions, like SPs or the RS version with Sql Server 2005 then I would also be very interested in the answer. I haven't had a chance to look into Sql 2005 and its RS version yet. Can anyone tell us anything about the printing options in later releases?
John
November 17, 2006 at 10:36 am
I have found that my pdf works as landscape if I set my Layout in the report to height of 8 1/2'' and width of 11''
February 14, 2007 at 12:42 pm
I did get the delivery sample to work in 2005. A little tricky getting the printer name correct in the config file. Once that was done, it worked great. Advice...follow the steps very carefully. 4 config files to change...reset iis and restart reporting services. Watch typos, will really mess you up. Only problem....everything prints in portrait. All settings in the report I need to print landscape are set correctly...margins, report properties, interactive size, etc. Still prints portrait. Exports to PDF as landscape, can print through VB app as landscape. Won't print with the extension in landscape. Tried to declare values in the C# app and still...only portrait. Any ideas would be greatly appreciated. THANKS!
February 14, 2007 at 2:41 pm
I haven't used previous versions of RS so apologies if I'm missing the point. In 2005, report manager does have a direct print for users. I find it works fine providing your report does not have external images. If you do have external images, exporting to pdf/excel first is much faster. I've had 3 minute print spool times with the direct route.
Hope this helps
K
Viewing 14 posts - 1 through 13 (of 13 total)
You must be logged in to reply to this topic. Login to reply