I have a PCL file that I generated using "print to file".
What's the best way to programmatically print this file in C#?
(Given of course that the printer I am printing to supports PCL.)
I know that I can print by invoking from a prompt:
copy filename.pcl //location/printername
So I would imagine that I could also do the same thing programmatically (using copy)... I wonder if there is a cleaner way to do this, say using PrintDocument.
Note that when I use PrintDocument:
var pd = new PrintDocument
{
DocumentName = @"filename.pcl";
PrinterSettings = {PrinterName = @"\\location\printername"}
};
pd.Print();
I always get a blank page printed.
This article applies to Visual Basic, but it is easy enough to follow to be able to apply it to C#, I think. Otherwise, I'll gladly assist you with any problematic parts.
If the printer is on the network, here's a little funny example of how to talk directly to it. Not sure if it also works if you simply send the bytes of the PCL to the printer though.