简体   繁体   中英

how do I accomplish secure printing in C#?

I need to print documents to the printer such that the user is required to enter a PIN before the document is printed out.

In my research thus far the only method I have seen accomplish this is to print the document to a PRN file and then edit the file in binar looking for

byte[] searchfor = System.Text.Encoding.ASCII.GetBytes(@"@PJL SET HOLD=OFF" + "\n" + "@PJL SET USERNAME=\"SYSTEM\"");

and replace it with

byte[] new_lines = System.Text.Encoding.ASCII.GetBytes(@"@PJL SET HOLD=ON" + Environment.NewLine + @"@PJL SET HOLDTYPE=PRIVATE" + Environment.NewLine + "@PJL SET HOLDKEY=\"" + User_Pin + "\"" + Environment.NewLine + "@PJL SET USERNAME=\"" + User_Name + "\"");

This seems a little silly to me. I have not found anything within the PrintDocument or PrinterSettings that seems to help.

While this is a solution, we print out large image files and if we then send this directly to the printer via a copy command then the RAM on the printer isn't sufficient to hold the entire document. I would like to have a more elegant way to steam to the document through the print queue so that the queue spool it to the printer as it can handle it.

Any help would be greatly appreciated.

Thank you,

Richard

这是因为它是打印机功能,可以选择通过驱动程序公开,而Windows无法做到。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM