Adventures in Data-driven Automation Systems

Wednesday, May 6, 2009

Reporting Services Delivery Extensions

I attempted to implement the Reporting Services Printer Delivery Extension sample last week, which I thought would be a fairly straight-forward task. As usual, I was wrong. The documentation was quite sketchy and I spent the better part of a day just trying to get SSRS to detect the extension. I suspected that I wasn't putting the CodeGroup element in the right spot of the rsxxxpolicy.config files, but couldn't find any documentation telling me WHERE to put it. I finally came across an entry in K. Scott Allen's blog that explained exactly where it needed to go, and I then thought I was sitting in high cotton (yeah, I know).

However, I soon found that SSRS wouldn't recognize my printer entry. After an hour or so of trying to attach a debugger, I finally found that the sample code compares the printer with the list of installed printers, but does a case-sensitive comparision. I modified the code to make it case-insensitive and next found that network printers do not show up in the list of InstalledPrinters. So I created a local printer using a TCP/IP port and SSRS (finally) detected it.

You would think I had to be getting close now, so I scheduled a report, watched it execute and voila!, I had a report on the printer! WOOO HOOO, this printer crap is a piece o cake. Right......

It printed, but it was scaled up when compared with the same report printed from ReportManager, and wouldn't display on one page. I started digging and found the Image Device Information Settings and began playing with the settings. It appeared my only options were the DpiX, DpiY, PageHeight and PageWidth settings. I began with the DpiX and DpiY, but no matter what I set these parameters to, I got no change in the scaling. The PageHeight and PageWidth didn't change the scaling, but it did change how many pages actually printed with certain settings.

After messing with these parameters for a couple of hours and running out of time, I decided to take another approach, since I had already spent almost two days and was really no closer to delivering a production quality report. I created a Windows service to monitor a file share for new PDF files, spawned an instance of FoxitReader in the background to print it, then renamed the file and moved it to an archive folder. Not exactly a perfect solution, but it works. And I still have my hair.


No comments: