Click here to Skip to main content
15,849,615 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi
I develop an ASP.NET solution that prints some reports, for testing purpose I wish to automatically save these reports as PDF files instead of prompting the user to select the printer

I create my reports with Crystal Reports. For economic purpose I have the habit to test my reports with PDF Creator.

My code runs when it's in debug/iisexpress, the user is prompted for choosing a name for the created file.

But when I publish the app on IIS, the code works, I can see briefly a entry in the printer spooler but nothing happend, no prompt, no file created ...

Here is the code but it seems legit the issue is somewhere else

report.PrintOptions.PrinterName = pPrinter
report.PrintToPrinter(1, 0, 0, 0)


Regards

What I have tried:

- I tried with Bullzip PDF Printer
- I tried to give all permissions to Everyone in the printer properties
- I tried to change the identity of the application pool in IIS
Posted
Updated 23-May-16 3:19am
v2
Comments
Richard Deeming 23-May-16 14:21pm    
It sounds like you're expecting the printer driver on the server to pop up a dialog box on the client to prompt the user for a file name.

That's not how websites work.

At best, the printer driver will realise that it's not running in an interactive process, and print to a random file in the temp directory.

At worst, it will pop up a dialog box on the server, where nobody will ever see it, and your code will hang waiting for the server administrator to log in to the server and respond to the thousands of copies of the dialog box that have been displayed.
pjaar89 24-May-16 2:54am    
I do not see the problem like this, you can configure these PDF printers to "print", ie generate PDF files, without having dialogue box ...

It must be possible

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900