Solved

LPD/LPR Printing Protocol

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

Suggested Solutions

Title # Comments Views Activity
creating threads in delphi 1 104
When i run adoquery my application freezes 26 166
Timesheet 2 18
Delphi problems to abort a printjob 9 20
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

778 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