[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

LPD/LPR Printing Protocol

Posted on 2009-05-16
4
Medium Priority
?
1,385 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 39

Assisted Solution

by:hdhondt
hdhondt earned 1000 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 39

Accepted Solution

by:
hdhondt earned 1000 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 39

Assisted Solution

by:hdhondt
hdhondt earned 1000 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

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…
Printers have changed substantially in the last 30 or so years, not just in technical capabilities but in cost and usage as well.  Printers were originally used for interfacing with the operator, not necessarily for printing copy or pictures. In …
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

649 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