Solved

LPD/LPR Printing Protocol

Posted on 2009-05-16
4
1,349 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:hdhondt
hdhondt 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:
hdhondt 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:hdhondt
hdhondt 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

809 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