Solved

LPD/LPR Printing Protocol

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Find and Replace Stream with 0s 8 57
Delphi: Connect to running MS Outlook 4 50
Timesheet 2 7
have users select default printer at login 2 8
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
When you try to share a printer , you may receive one of the following error messages. Error message when you use the Add Printer Wizard to share a printer: Windows could not share your printer. Operation could not be completed (Error 0x000006…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

863 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

16 Experts available now in Live!

Get 1:1 Help Now