I have an application that executes an SSRS report to create a file, which is saved locally in PDF. I would like to print the file, but we have been experiencing problems with the Acrobat Reader security settings, which are stopping the print from happening - our security guys and app support have said that Acrobat is not an option and I need to find another way to print the report.
All of the computers that will be used to run the app have Google Chrome installed, so it seems sensible to me to use this to open and print the PDF. We can set chrome as the default application for opening PDF files, and with this done, I had the following code snippet running (after some research online):
Process process = new Process();
PrintDialog printDialog = new PrintDialog();
numberOfCopies = printDialog.PrinterSettings.Copies;
ProcessStartInfo starter = new ProcessStartInfo();
starter.FileName = "\"" + printFileName + "\"";
starter.Arguments = "\"" + printDialog.PrinterSettings.PrinterName + "\"";
//starter.Verb = "printto";
for (short s = 1; s <= numberOfCopies; s++)
{
starter.CreateNoWindow = true;
starter.WindowStyle = ProcessWindowStyle.Hidden;
starter.UseShellExecute = true;
process.StartInfo = starter;
process.Start();
//... more code
With the line starter.Verb = "printto";
commented, chrome opens the PDF, but adding the verb causes an error to be returned saying there is no default app for that file type. I have been doing some research and it seems maybe I should be using headless mode, but all I have found there is command line stuff and ASP.NET.
I believe that a previous developer had problems with MS Word as well, so would prefer to avoid that route if possible - I think there was something to do with Citrix, but not sure.
Does Chrome support the use of the print command like this, or am I on a hiding to nothing? If it does support, what am I doing wrong / how could I do it better (e.g. headless mode?)? If it does not support, is there some other way that I can use to print a PDF without using acrobat?