Solved

LPD/LPR Printing Protocol

Posted on 2009-05-16
4
1,319 Views
Last Modified: 2013-11-23
I've to send spool to a printer using LPD/LPR protocol ...
Do you know a component for Delphi environment (delphi 7 and/or Delphi 2006) good for this scope ?
Thanks
0
Comment
Question by:ccarrano
  • 3
4 Comments
 
LVL 38

Assisted Solution

by:Herman D'Hondt
Herman D'Hondt earned 500 total points
ID: 24405688
If you send the output to a file, you can then use Windows' LPR command to send that file to the printer.
0
 

Author Comment

by:ccarrano
ID: 24410004
Thanks for suggestion, but I should like to programmatically manage files to print. So, if possible, I'm searching a Delphi component. Otherwise, can you suggest me hot to call LPR command from a Delphi program and ho to verify results ?
Thanks
0
 
LVL 38

Accepted Solution

by:
Herman D'Hondt earned 500 total points
ID: 24410543
I don't know anything about Delphi, but you can launch an external application with the ShellExecute command. That way you can run LPR. See:

http://www.latiumsoftware.com/en/delphi/00002.php

The linka also says that the application started this way will run asynchronously, i.e. you Delphi application will not wait for it to finish. That is normally OK but may cause problems if you try to create another print file with the same name before the first one is finished. A link at the bottom of the page shows how to get around that. Alternatively, if you use a batch file to run LPR and then delete the file, Delphi can check for the existence of the file, and wait until it has been deleted. Yet another way is to use a unique file name each time.

What do you mean by "verify the results"? There is no way Delphi can verify that the job has been printed successfully. All you can ever know is that it has been sent to the printer. What happens in the printer hardware is unknowable. However, if LPR can't send the job (e.g. because the printer is switched off) it will return an error; a batch file can check for that and leave the file, so it can be printed at a later time.
0
 
LVL 38

Assisted Solution

by:Herman D'Hondt
Herman D'Hondt earned 500 total points
ID: 24410554
I forgot to add, to use ShellExecute, you must add the unit 'shellapi' to your uses clause - like this:

uses ShellAPI;

See

http://www.borlandtalk.com/execute-dos-command-from-delphi-win32-application-vt105872.html
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

If you use a Brother DCP 130C or similar Brother printer, at some point you might encounter the following problem: after you change the ink cartridge, the printer displays an "ink empty" message. Sometimes you just need to follow the instructions…
This seems to be a very common error related to the Samsung printer driver. First, this is the error we're talking about: Log: System Type: Error Event: 7000 Agent Time: 3:37:24 am 22-Apr-09 Event Time: 6:07:24 pm 21-Apr-09 UTC Source: Se…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now