Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 12061
  • Last Modified:

PCL language

Hi,
    I am writing an application which generates the printer language for my custom apllication.
I am trying to generate the specific PCl5 language for my laser printer ( HP Color LaserJet 5M )
using java. The code I am using is shown below. It creates the PCL5 command as a string. Then it converts it to the bytes and pushes it to the printer. Since I am pushing it in the autosense mode the printer should understand it. But I am getting offending error. The printer is not recognising my PCl5 commands.Is there any problem with the PCl commands I am sending. I doubt whether the escape character is being send correctly.

char x = (char)27;      
String l_printInput= x+"E" +x+ "&l0E" +x +"&a0c0R" +x+ "*c2400a3300b0P" +x+ "*c0P" +x+ "E";
byte[] l_printByte = l_printInput.getBytes();
DocFlavor l_docFlavor = DocFlavor.BYTE_ARRAY.AUTOSENSE;
Doc l_doc = new SimpleDoc(l_printByte , l_docFlavor , null);
l_printJob.print(l_doc , null);
       
    Also is there any sites in which I have some examples for using PCl5. I have the reference manual from HP but without examples I am not able to use it fastly.

Rgds
jack
0
crackjack010
Asked:
crackjack010
  • 2
  • 2
1 Solution
 
DRRYAN3Commented:
Why do you start i_printInput with a printer reset ESC-E and end it with an ESC-E?  I think the ending ESC-E gets rid of the features you just turned on.
0
 
crackjack010Author Commented:
Hi,
    Thanx a LOT. It worked.
Can you please help me with two more doubts that I have.
1. When are these  printer reset commands used. I mean should I reset the printer after I print my stuffs using PCL. Because I removed only the initial reset only and it worked.Then I removed the end one only and then it worked. And now when I didn't remove both it is working.And now when I removed both it is working. I don't know what is happening.Because the same was not working yesterday.
2. Also is it necessary that I should send the PJL commands for every print job I send.
Can you also send me a basic (IF possible) structure of the PCL5 code I should send. Say the PJL command first (Esc-12345X first etc..).then comes the PCL commands.Or an example pcl file.
Thanx any way for the help.
Rgds
jack
0
 
DRRYAN3Commented:
Usually, you send a reset at the start of the first printed page and another at the end of the job to clean up.  The ESC-E reset is a PCL (not PJL) command.

You should never assume the printer is setup the way you want it.  Always sent the complete set of printer commands necessary to configure the printer the way you want it.

The PJL code should be sent first.  PJL has nothing to do with your printout, but how the printer itself is set up.  The PCL codes should be embedded into your data as necessary to format the page they way you want it to appear.  Remember that PJL stands for Print Job Language and PCL stands for Page Control Language.

A sample is going to be difficult - I don't know what you are printing or how you want it to appear.  Glad I could help clear up your question.
0
 
crackjack010Author Commented:
Thanx a lot.
Will Get Back to U once I have some more problems. :)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now