C# RAW Printing - c#

I have a requirement whereby I need to be able to send an image to a printer.
The problem I have is that the target printer (and type) is not necessarily know at the time of printing and we could be sending to a zebra/intermec label printer or a standard HP office jet.
One further complication is that we have hundreds of printers to manage.
I do not want to have to install hundreds or printers and have to manually install a new printer every time we add one to the network. We maintain a list of IP Addresses and ports.
I have been considering installing a default printer (zebra, intermec, officejet) for each of the printer types.
When printing (using PrintDocument) I can send a print to the default printer of that type but mark the output as "PrintToFile". I believe this would then give me the raw print data (PCL?).
My thought process is that I should then be able to simply send the raw data to the printer? Unfortunately this does not seem to work and the raw text is simply printed.
Can anybody offer some advice/help?
Thanks in advance.

Raw files will not be sharper than the JPG files on printing, for me the best solution is to convert the RAW file in JPG

Related

Sending PDF Byte Array to Print

I'm trying to get my web app to send a PDF document to a networked printer but, all of the examples I've seen all require a physical file to already exist, which doesn't work for what I need.
I have a service that given an id, returns an object where one of the properties is a byte array of the PDF document.
How do I send this to a named network printer?
I have tried evoPDF's PDFPrint, but it is rasterizes the PDF document before sending the content to the printer, which is inflating a 14KB file to over 40MB which seems ridiculous.
The evoPDF support said nothing can be done to change that, so I need to find an alternative.
The web app would be sending hundreds of 3/4 page documents at a time, and waiting for the printer to spool upwards of 50MB for each one is not acceptable.
Is there a better way?
You can try with this library http://www.terminalworks.com/pdf-print-net.
It should support printing from byte array.

How to get document in print queue

Is there any way in C# to get the documents sent to the printer from another program and use those documents again for something else?
I want to build an application which can get invoice sent to the printer by some point of sale system and gives opportunity to send that invoice to customer's email.
Well, you could print to the XPS printer and have it create a file. Then, let the system print the XPS file using the standard application. This may or may not work depending on some factors:
Is there XPS support on the system?
Did the user change the default application that handles XPS files? Maybe printing is no longer possible...
Is XPS a file format you want to send to the users?
etc.
That said, of course you could do the same thing with PDF, but you'd have to have access to an application that can actually print PDF. It has been asked multiple times here how to "send PDF bytes" to a printer - you can't. There are solutions, but in the end you have to answer this question for yourself:
Is it really worth the hassle or isn't it just easier to print the document and then create it again as PDF (for examples) to send to the user?

Logging raw data from usb printer and using print spooler

I know similar question have been asked before like here and a few other places.
but I want to ask something about the basic concepts.
So, i have been assigned a project i have to make a "usb logger". The main function of the project is to capture data transmitted from PC to Usb printer on the logger software so raw data of each printout can be saved into a file for logging and analysis.
I was told that i can use a third party tool like usbpcap but I suggested why dont we get directly data from print spooler. as far as i know print spooler maintains a queue of the data to be printed.
before i start working on this project i want to ask a few basic questions
1) what is raw data in this scenario ?
2) can I achieve this by getting directly from spooler or is there another way.
3) which one will require more pc resources communicating with usb port or spooler?
I just need to understand the domain completely. (i will be developing this project using C#)
Thanks
If what you need to do is capture the entire output in raw form, the easiest way to do that is with a port monitor. A port monitor sits between the spooler and the physical output device and writes the raw data to that device, so it's the natural place to capture such data.
What you need to do is install the Windows WDK and take a look at the sample port monitor. You should be able to use that with very few modifications. Mainly, you just need to add code to write the data to a file somewhere in addition to writing it to the printer. You also need to change all the code dealing with the registry since the sample assumes it is the default port monitor and writes to registry keys reserved for Windows.
Just be aware the version 4 print drivers (ie, Win8) do not support custom port monitors. However, Win8 still supports v3 print drivers, which should cover any printer currently out there.

How to work on Bixolon POS Printer using C#

I've been programming an application that deals with a POS printer. The printer is BIXOLON branded, and I haven't found any SDKs for using this type of printers as well as no example on how to deal with it.
Since I'm new to this type of printer, I don't know how should I design my report as well as which report engine should I use.
Any advice will be helpful.
I have worked on POS printers before to issue receipts etc.
What I did is to read in a template from a rtf file, set some variables that is to be replaced.
For example for the receipt I want to have the name of the person, so in the rtf file template, I would put something like <NAME>. When I read in the content of the rtf file, i just do a string.replace to replace <NAME> with the actual text in my program. Once I have replaced all the variables, using the class found in this link.
http://msdn.microsoft.com/en-us/library/ms996492.aspx#wnf_richtextbox_topic06 , I have a well formatted rtf and ready to be printed.
Printing wise works just like other printer. This means that as long as your coding targeted the correct printer and using the correct setup, it should be printed correctly. The only difference is that printing on a office printer would give u a A4 size, whereas printing on a POS printer will give you the size allowed by the POS printer. Just remember to format your rtf well.
Most report engines (I'm thinking of Reporting Services in particular) won't need this level of programming to print reports. You will get that functionality out of the box as long as the printer drivers are installed on the machine you wish to print reports from.
It was so simple, I used crystal report to design my report and then easily show.

How to print to barcode printer from windows-mobile 2005?

I need to print to barcode printer (zebra) from windows-mobile 2005 (motorola hc700)
I search any sdk...not fount how to print.
thank's for any help
Check out the new mobile SDK from Zebra. It works with BlackBerry and Windows Mobile
ZebraLink Multiplatform SDK
This is based on my experience from 2006.
I had to use sockets in C# to send ZPL code to the printer. The "ZPL Code Generator" was hard-coded specifically to the one label format we needed; however, a template file with strategically placed search-and-replace strings would have been a better solution. There was a ZPL guide included with the printer and I'm sure you can get one from their website.
The Windows drivers were awful at the time and only produced garbage output. A couple developers before me had other approaches and both failed after a few weeks.
Edit:
Link to MSDN .Net Sockets. When
From my project, the port you should use is 6101. But that may be specific to the QL320.
The ZPL guides from Zebra are pretty good and I had little reason to devote the language to memory because it was just one small project.
Also, your printer may use EPL instead of ZPL but Zebra's guide for that is equally good. Either way, if the text you are sending to the printer is relatively constant, just create a file that correctly prints when streamed to the printer and then put in "replace me" blocks for your app to put in the dynamic values.
I'm also assuming that you are accessing this via a network. If your connecting it directly to the device, this changes slightly (I believe it gets mapped to COM port for most devices).
All that, and no mention of
http://www.zebra.com/id/zebra/na/en/index/products/software/label_design_software/label_vista.html
We developed our label code by creating the labels in label vista and using telnet to send them to the printer for printing. Repeat until you have it like you want, then code it.

Categories

Resources