We are using following code to Print PDF. Although this code works perfectly fine on local machine but when deploy this code to server it is not working.
Thanks for your inquiry. Please check sample code for printing PDF document from memory stream using print dialogue. Hopefully it will help you to accomplish the task.
But the solution you provided do not solve our problem of printing the PDF.
The namespace System.Windows.Forms is not supported on IIS hosted Web Application, therefore it throws error as it tries to find default printer of server, which is not configured.
We need to show Print Dialog to user and use client machine printer not the server network attached printer.
Hope to find a solution soon.
P.S: We are using Aspose in Public facing website, so user can access this site from anywhere, and it should look for local printer of user.
Thanks for your feedback. Please note printers are usually installed on user’s profile (especially if it’s a network printer, not a physically connected one such as on USB or parallel cable). When Administrator sees a printer it doesn’t necessarily mean they’ll be available when other user is logging on the same machine. ASP.NET applications runs as ApplicationPoolIdentity or NerworkService credential by default so the web application is unlikely to see the printers there.
There are two solutions:
1) Create an account for .NET application pool to run on, and then login as that user on the server and add the printers there
2) Run on web site under Custom account (Identity property in site’s pereferences) that is already able to work with printers.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.