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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I send PCL commands to laser printer from VB application? 1

Status
Not open for further replies.

Consult

Vendor
Oct 8, 1999
1
US
We use a good number of printer overlays that are stored on hard drive of laser printers and invoked from applications by &quot;transparently&quot; sending PCL commands to the printer(s). How is this accomplished in VB? For instance, if we wanted to send the following string to the printer Chr$(27) & &quot;&f70504X&quot; how would it be done. The Printer.print doesn't let the escape character pass through transparently, etc. Thanks for your help.<br>
<br>

 
This is not an elegant solution, but I have sent control characters to an obsolete (no driver available) printer by using the print command.<br>
<br>
I never found out how to trap any error responses.<br>
<br>
JohnK
 
Hi Consult!<br>
<br>
Have you tried using the Generic/Text-Only printer driver?<br>
<br>
Chip H.<br>

 
I use this in a vb3 project. I can't remember where I got it from. It uses the Windows API function 'Escape'. I place all of the PCL code (commands AND data print) in a string variable (PCLdata$).<br>
<br>
Const PASSTHROUGH = 19<br>
<br>
'i'm not really sure what this line does<br>
PCL$ = Chr$(Len(PCLdata$) Mod 256) & Chr$(Len(PCLdata$) \ 256) & PCLdata$<br>
<br>
printer.Print &quot;&quot;<br>
result% = Escape%(printer.hDC, PASSTHROUGH, 0, PCL$, 0&)<br>
<br>
If result% &lt;= 0 Then<br>
MsgBox &quot;Attempt failed.&quot;<br>
Exit Sub<br>
End If<br>
<br>
printer.EndDoc<br>

 
&quot;Escape%(printer.hDC, PASSTHROUGH, 0, PCL$, 0&)&quot;<br>
<br>
Sounds interesting - have you got the function declaration bit as well?<br>
<br>
Mike<br>
<p>Mike Lacey<br><a href=mailto:Mike_Lacey@Cargill.Com>Mike_Lacey@Cargill.Com</a><br><a href=http:// Cargill's Corporate Web Site</a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top