Intercept Print Jobs - printing

We have some computers on which we charge for printing documents. When a user prints, I would like to intercept the print job, prompt them for their username / password so I can charge their account, then allow the print job to continue through to the printer.
How can this be accomplished? Is it possible to write such a utility in .NET?

You really need to look at creating a Port Monitor for this. Far from simple. You could look at RedMon. BTW: Many printer vendors offer solutions to this which use codes that are embedded into the print stream (PCL/PS) and the data is collected and retained on the printer.
For example, Xerox has something called Standard Accounting. When enabled in the driver it embeds PJL codes like this:
#PJL COMMENT OID_ATT_ACCOUNTING_INFORMATION_AVP "XRX_USERID,xxxx";
Once the job has been printed the device makes reference to the user, number of pages etc. which can then be reported on.
The problem you will run into when doing this on the workstation / server is that detecting the number of pages printed can be difficult. If you are trying, for example, to charge by the page you might be able to parse the number of pages from the file, or run through a PCL or PS RIP and determine but if they have a flag for 2up or 4up on the page and that work is done by the printer and not the driver, you will charge the client for 4 pages when they really only printed 1. That is one of the many pitfalls.

Related

Okidata MB760, MB492, etc. PJL commands

I have used PJL commands with some HP printers to set printer control panel display message and duplexing of PDF documents. I have some customers with similar requirements using Okidata MB760 and MB492 machines. I know the Okidata machines support PJL, but it appears to be a different set of codes from HP (as is the case with every manufacturer - no standard for PJL except the entry/exit codes). Okidata support was unable to provide a programmer's manual or a PJL reference. Does anyone have information specific to these machines or (since each manufacturer tends to use the same codes with slight variations for a long time) for any other Okidata MB machines?
No response, not even comments. I did some testing via "print to file" in Windows and it looks like I can extract enough PJL from there to do what I need to do. But I still hold some small bit of hope that someone - maybe a helpful insider at Okidata? - will post some sort of PJL reference.
You can download a program called PCL Paraphernalia which allows you to connect and execute some PJL commands.
It's not the sleekest of interfaces but the Status Readback Utility option should allow you to retrieve all the allowed variables from the printer

How to get a printer to report back to in house application

I want a printer to report back to my in house application the accounting code the user typed in. How do I do that?
Note to mods: mods at serverfault sent me here.
The answer is printer manufacturer specific, and you haven't specified what printing infrastructure you have.
Each manufacturer implements this type of accounting in a different way, and most have changed methods over time.
It could come back via LDAP, an API call, or SOAP web service.
It could be that you have to poll the printers to retrieve their per-user or per-department counters for colour, b&w, stapling etc.
It could be that your solution is influenced by the access control solution you use, like swipe cards, tokens or mobile phone proxmity, as these often have integrated job accounting functionality.
There could also be a central management app, that accumulates the data from many printers, like HP's Access Control Job Accounting.
The solution you choose also depends on your scale, ten printers or a thousand.

If i could print across network, why can't i scan?

I recently purchased an HP Deskjet wifi-enabled printer (model no. 3515). Set it up successfully as good as that both me (in the same network as the printer) as well as another person few miles apart from me (having different isp than mine) could print wirelessly successfully.
The printing across network (printing from a network other than that to which the printer is connected) has been set-up and tested successfully both through Google Cloud Print and HP ePrint Software.
However, when it comes to scanning across network, or cloud scan as we may call it, none of these two support, or even say anything about, it. Talking to an HP customer care executive about it was fruitless as i expectedly got no better answer than 'it is not possible'. Also, unfortunately, I have not found anything worthwhile on internet regarding this either.
What my understand is - if printing could be done wirelessly across network, so could be scanning. After all, in both we do roughly the same thing but in opposite direction. That is, in layman's terms, if i am not wrong, in printing we convert digital information into hardcopy document, and in scanning it is just the other way round.
Please correct me if am assuming too many things too wrong.
HP ePrint is email based, i.e. the printer acts as an email client that polls a mailbox for print jobs. When you print to the cloud, your printjob goes to your printer's mailbox and the printer fetches the job from there. It is pretty much one-way, in the sense that you just send off the print job and hope it gets printed and there can be many different clients submitting print jobs to the same printer.
Scanning is much more complex and actually requires a fully working two-way communication, i.e. the computer is interacting with the scanner to tell it do to do a preview scan, selecting scannable areas/size, setting resolutions, etc. while getting instantaneous responses and data from the scanner. So it is not really feasible to do via a mailbox, and at least not via the printer's mailbox as you cannot read results from its mailbox.
You would think it would be possible for the scanner to send scanned pages to your mailbox, but I guess the implementation is just not there yet. There are some security implications, such as it would be a bad idea to start a scan job from a remote location, because then any bad guy could try to scan whatever secret document you happen to have placed in the scanner. But if you were to initiate the scan from the scanner and there select the email address to send the results to, it should be secure enough. I guess the developers at HP are saving some features for the next generation of multi-purpose devices so they can sell you a new device next year.. :)

Printing from one Client to another Client via the Server

I don't know if it sounds crazy, but here's the scenario -
I need to print a document over the internet. My pc ClientX initiates the process using the web browser to access a ServerY on the internet and the printer is connected to a ClientZ (may be yours).
1. The document is stored on ServerY.
2. ClientZ is purely a cliet; no IIS, no print server etc.
3. I have the specific details of ClientZ, IP, Port, etc.
4. It'll be completely a server side application (and no client-side on ClientZ) with ASP.NET & C#
- so, is it possible? If yes, please give some clue. Thanks advanced.
This is kind of to big of a question for SO but basically what you need to do is
upload files to the server -- trivial
do some stuff to figure out if they are allowed to print the document -- trivial to hard depending on scope
add items to a queue for printing and associate them with a user/session -- easy
render and print the document -- trivial to hard depending on scope
notify the user that the document has been printed
handling errors
the big unknowns here are scope, if this is for a school project you probably don't have to worry about billing or queue priority in step two. If its for a commercial product billing can be a significant subsystem in its self.
the difficulty in step 4 depends directly on what formats you are going to support as many formats are going to require document specific libraries or applications. There are also security considerations here if this is a commercial product since it isn't safe to try to render all types of files.
Notifications can be easy or hard depending on how you want to do it. You can post back to the html page, but depending on how long its going to take for a job to complete it might be nice to have an email option as well.
You also need to think about errors. What is going to happen when paper or toner runs out or when someone tries to print something on A4 paper? Someone has to be notified so that jobs don't just build up.
On the server I would run just the user interaction piece on the web and have a "print daemon" running as a service to manage getting the documents printed and monitoring their status. I would use WCF to do IPC between the two.
Within the print daemon you are going to need a set of components to print different kinds of documents. I would make one assembly per type (or cluster of types) and load them into your service as plugins using MEF.
sorry this is so general, but you are asking a pretty general and difficult to answer question.

Tool for parsing SMTP logs that finds bounces

Our web application sends e-mails. We have lots of users, and we get lots of bounces. For example, user changes company and his company e-mail is no longer valid.
To find bounces, I parse SMTP log file with log parser. The logs come from Microsoft SMTP server.
Some bounces are great, like 550+#5.1.0+Address+rejected+user#domain.com. There is user#domain.com in bounce.
But some do not have e-mail in error message, like 550+No+such+recipient.
I have created simple Ruby script that parses logs (uses log parser) to find which mail caused something like 550+No+such+recipient.
I am just surprised that I could not find a tool that does it. I have found tools like Zabbix and Splunk for log analysis, but they look like overkill for such simple task.
Anybody knows a tool that would parse SMTP logs, find bounces and e-mails that cause them?
As far as I can see, log file analysis is really only useful to detect mails which are rejected at the SMTP session level. What about bounces which occur after the remote MTA has accepted a message for delivery but subsequently fails to deliver it?
We use the following set up to detect and classify all bounces after delivery to the remote MTA.
All outgoing mails are given a unique return-path header which, when decoded, identifies the recipient email address and the particular mailing.
An Apache James server which receives mail returned to the returned-path address.
A custom mailet, developed in Java and executing within Apache James which decodes the to address, sends the email text to boogietools bounce studio for bounce type classification and then persists the results to our database.
It works very, very well. We are able to detect permanent hard bounces and transient soft bounces which are further classified into very granular bounce types such as spam rejections, out of office replies etc.
This article is exactly what you are looking for. It is based on the great tool log parser.
Log parser is a powerful, versatile
tool that provides universal query
access to text-based data such as log
files, XML files and CSV files, as
well as key data sources on the
Windows® operating system such as the
Event Log, the Registry, the file
system, and Active Directory®. You
tell Log Parser what information you
need and how you want it processed.
The results of your query can be
custom-formatted in text based output,
or they can be persisted to more
specialty targets like SQL, SYSLOG, or
a chart. Most software is designed to
accomplish a limited number of
specific tasks. Log Parser is
different... the number of ways it can
be used is limited only by the needs
and imagination of the user. The
world is your database with Log
Parser.
You don't want to parse the logs to try and identify bounces. You will have both false negatives and false positives if you just look at logs.
Bounces might be generated downstream from the server you deliver to. They will look like successful deliveries in your outgoing server logs.
The naive pattern match for bounces in incoming logs (from the null sender, to one of your VERP-ed addresses) will be inaccurate. There are a few reasons why:
There will be delay warnings mixed in with actual failure bounces.
Most Out-of-Office and similar autoresponders use the null sender to prevent battlin-bots syndrome.
Similarly, challenge-response systems (like *spit* boxbe.com) tend to use the null sender.
Your VERP-ed sender addresses, if they are persistent per recipient, will get harvested by spammers and come back as either spam targets or backscatter.
So, sadly, the only reliable way to do it is to examine the bounce messages themselves. Most of them will have a "report/delivery-status" MIME part as per RFC1894, and depending on your language of choice there are probably libraries or modules to help with other bounce formats. The only one I have direct experience with is the Perl Mail::DeliveryStatus::BounceParser module, which works well enough.
I like logParser. When I need to parse for somthing very specific or custom or using regular expressions, I use biterScripting. They actually have some sample scripts that I used to get started. One is at http://www.biterscripting.com/Download/SS_WebLogParser.txt.
I based a bounce counter program on this post, only to find out later that this method doesn't actually work for high-volume senders because SMTP logs are not in sequential order. There's more about it in my blog post: Email Bounce Detection in SMTP Logs and Why It Is Impossible.

Resources