Click here to Skip to main content
15,884,592 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
How I can send a PCL file to printer in C++ ?
I have installed in my machine 5 printers, I want to choice the printer and send the PCL to that printer...

I can send the PCL file to printer by hand, but, I need to share the printer and send the file using a COPY command of dos.
I want to know how I can send that file to specified printer, selected in Printer Dialog of windows...
Posted
Comments
Member 14975367 28-Oct-20 8:53am    
Can u tell how to send & readback pcl file from printer

There is an old KB article HOWTO: Send Raw Data to a Printer by Using the Win32 API[^] referring to Windows 9x and NT. So I don't know if it is also working with newer Windows versions. All you need to know is the name of the printer. Then read the data from the PCL file and write it to the printer.
 
Share this answer
 
The dos command is copy file.pcl LTPn. However if it's a network or USB printer you may not able to do that as DOS does not know about that devices...
 
Share this answer
 
Comments
Alexandre Bencz 28-Jan-14 8:46am    
Yes, I know that!!!!!!! ...... how I can send the file to the printer so ?
Kornfeld Eliyahu Peter 28-Jan-14 8:49am    
Using DOS - there is no way... I'm sorry...
Jochen Arndt 28-Jan-14 9:06am    
You can use the system() command:
system("copy some_path\\file.pcl LPT1");
Kornfeld Eliyahu Peter 28-Jan-14 9:17am    
It's not a problem. The problem is that for DOS command the printer has to be attached to one of the LPT ports, otherwise DOS can't see him...
Jochen Arndt 28-Jan-14 9:27am    
System() opens a command shell which is not DOS (when not using Windows 9x). But you are right that the printer must be assigned to a LPT port. If the printer is shared, the share can be redirected to a LPT port:
NET USE LPT1 \\mycomputer\printershare

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900