Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing under DOS mode from VFP

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
I am Using VFP 6 and am able to print a text file using Copy file command. I use [Copy File XX.txt to LPT1]. But When i configure a network printer to the Port LPT2 and say
[Copy file XX.txt to LPT2] it is not printing. I am able to print the same text file from DOS Editor after setting the Port Options to LPT2.

Can anyone guide me on this issue. I tried even Run Type but unable to find a solution.
 
If you're only doing this on your own machine, try adjusing the settings for that port: You have to have "Enable printing from DOS programs", Turn spooling on and off, with spooling on, try Spool format as "Raw" or "EMF" (Raw worked more reliably for us).

If you're planning on distributing this application, I would Highly recommend NOT trying to print from a Dos session: It is nearly impossible to fix this issue over the phone. Use some other method: Either VFP reports, SET PRINTER TO and @ says, a third party reporting tool (eg Crystal Reports) or, my favorite (since I wrote it to solve this very problem) a Window Printing tool like WinPrint (see ) ... It does exactly what you're trying to do: Takes a Text file and sends it to the Windows printer. It's tons more flexible, though. Take a look!
 
Hi Ganesh,

try this:

cPrt=getprinter()
cFile="file.txt"
cStr=filetostr(cFile)
SET PRINTER TO NAME "&cPrt"
??? cStr
* ??? send to the printer without passing trought the
* printer spooler. You dont need to map lptX:
SET PRINTER TO
SET PRINTER OFF
Andrea C.P.
Italy
 
Also try:
Copy file XX.txt to LPT2.DOS

The 32-bit OSs tend to like these qualifiers.

Rick
 
Here is another solution.....

In the Dos window type:

Net Use LPT2 \\<computer>\<printer> /Persistent:Yes

This will take care of your DOS printing to network printer problems.

If you have problems with the command you can get all the parameters with &quot;Net Use ?&quot; in the DOS window.

Good Luck

Allen &quot;Uncanny&quot; Schott

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top