How do I make Windows Server 2012 R2 reckognize installed printer - c#

I have a web forms application that creates a PDF and sends it to the client. It was all well and dandy until I uploaded the aplication to Windows Server 2012 R2. The problem might be some printer settings on the server (this is my first time working with a server).
The problem is Server 2012 doesn't support Windows Print to PDF, which I used on local machine and it worked great.
I gave a shot to CutePDF Writer: installed it and set it to default printer in Printers and devices. When I run the application, I get the following error:
System.Drawing.Printing.InvalidPrinterException: No printers are installed
I tried this and it generates the PDF but fails and I get an error when I try to open the PDF:
PrintDocument.PrinterSettings.PrinterName = "CutePDF Writer";
This line returns "true":
PrintDocument.PrinterSettings.IsDefaultPrinter
while this line returns "Default printer is not set.":
PrintDocument.PrinterSettings.PrinterName
I gave a shot with this, but returns "false":
Setting the default Printer for windows using c#
Please help!

The answer is trying a different approach. I shouldn't have tried working with the virtual printer (i haven't found a way to make it work).
To create a PDF from code, the best way is using iTextSharp.dll. With that you need a handful of code. Yes, I had to implement the report-creating and printing logic all over again, but it was actually easyer than the previous approach. iText is pretty straightforward and easy to use!

Related

RDLC Print Directly to Printer C# MVC

I have read many post about this here on stackoverflow(most links to Microsoft are not displaying the page for help to explain this as of Jan 9 2018 ) and even did a bypassprintpreview.cs file and everything seems to work except for a few issues.
My question is what is the best practice to skip the ReportViewer and send to the default printer in a C# MVC Project.
Is this printing it to a PDF then send to the printer, Drawing it out then printing or are there NuGet packages that anyone can recommend.
I found a solution for this question in this link How to print directly without showing report viewer in rdlc report, i used this class and it work for me in Windows Forms Application and Web Application but my web application was Hosted on IIS so this did not work for me because the app was not able to access the client installed printer, so the best solution for me was in this video, I created i console application 'PrintDirect' and Registered protocol on system to access this console application and send the parameter by anchor link like this
click to print order 1906187<br />
I hope the solution is clear

Running Bartender on a single machine over network

I am using Bartender Enterprise Automation edition for Label Printing. As of now, Bartender is installed on machines on which we intended to print the labels from.
Now, I have an windows forms C# application, which invokes Bartender Engine and prints the labels.
If a machine does not have Bartender Install on it, my app can not print the labels.
So, is there a way to install Bartender on a single machine (let's say our production server which is up and running 24 X 7 and on local network connected to each and every machine ) and whenever "Print Label" button is pressed from my Windows Forms application, necessary data and Label Template file (.btw) will be sent to that machine and that remote machine will print the labels for me.
this way I won't require to install bartender each and every machine in my company. I did try looking for the solution online but there isn't much documentation for this online.
Please share some knowledge if someone have explored in this area.
Bartender do have support for Web Print Server , I am not sure if it is available for the version you mentioned.
It works like this : https://www.barcodesinc.com/news/?p=3203
http://www.seagullscientific.com/media/101387/web-based-barcode-and-label-printing.pdf
These are some helpful links related to this topic :
I have been working on this and seeking solution as you have asked but no luck. Unfortunately you have to install BarTender suite on each client. My organization has purchased enterprise license 2016 and I thought that Print Portal and Print Maestro might solve this problem but they both are developed for different purpose.
I haven't tried both of them yet. If you find anything, let me know. Thanks
You should be able to solve this with using BarTender Integration. Integration is used to automatically print labels without having a user see BarTender. If you can export your data to a csv file and drop it in a folder BarTender Integration will be able to pick it up and print it to the correct template. The integration will run from a server so you don't need to install it on every computer.
I have an idea, since you do not like to install Bartender all over the machines in your company. Then i suggest you to create another windows form c# application to communicate with the one you have originally to print labels.
You should be able to print labels to different printers through local network.
PC A
Installed Bartender and Have the windows form c# application to print labels
PC B
Do not have Bartender installed
Have another windows form c# application to send information to PC A

How to print PDF directly to printer with C#

How can I print PDF directly to a printer with (asp.net) C#?
I actually want to print the PDF directly without showing a dialog on the server side in asp.net c#
You'll be hard pressed to make this from asp.net if the server isn't residing in the same LAN as the client and can have the same printers installed, this due to security functions inside the web browsers not allowing websites to print to a local machine. You might get a solution for this if you implement some ActiveX Component or Java applet to run this (even seen it in Silverlight, but that's going away).
Something like http://www.vbgold.com/index.shtml#AdvancedPDFPrinter might help you achieve what you're looking for.

Capture print errors with System.Drawing.Printing.PrintDocument

The application my team is working on is developed using WPF & ,NET 4.0. The application also communicates with thermal printer connected to PC (like the ones used in malls, but its not a POS system). We only have 1 printer connected to the PC.
The application connect to printer and the output is often successful without any issues and parallel we save the data into the DB (SQL Server 2008 and going to SQL Server 2012).
On a very rare occasions the printout is not available but the data is saved to DB.
Is there any way to check or capture the printer related issue when we face this type of problem?
Thanks in advance.
Please Check whether your drivers are up to date.
And use debugging to check whether an error occurs when executing the code.
for this you can use try catch blocks which throws exceptions.

Printing WCF - network printing issues [duplicate]

I get the error mentioned when printing to a network printer.
The error does not occur when run under XP/Win2003, in a WinForm app or when a local printer is used.
The error does only occur when run as a Windows Service under Vista/Win7/Win2008 and printing to a network printer.
The Windows service runs under a network user that has access to the network printer. Before I print I check if the printername (including network path) is ok by looping through the available printers.
How can this be solved?
Solved by adding the printer to the SYSTEM user via a registry hack as described in the Microsoft doc: http://support.microsoft.com/kb/184291/en-us.
For anyone that stumbles across this issue in the future.
Double check that your Printer Name is correct as it could also be the reason you might be getting this error.
In my case we got same error for windows 10 os client computers.
I think the error is related users and their permissions.
After making the client computers to our company's domain the error was fixed.

Categories

Resources