• ×
    Information
    Need Windows 11 help?
    Check documents on compatibility, FAQs, upgrade information and available fixes.
    Windows 11 Support Center.
  • post a message
  • ×
    Information
    Need Windows 11 help?
    Check documents on compatibility, FAQs, upgrade information and available fixes.
    Windows 11 Support Center.
  • post a message
Guidelines
From questions to kudos — grow your reputation as a tech expert with HP Support! Click here to sign up.
Archived This topic has been archived. Information and links in this thread may no longer be available or relevant. If you have a question create a new topic by clicking here and select the appropriate board.
HP Recommended

>> ... Can I get a sample message print by any commands using Deskjet 2000 ? ...

 

Probably only by emulating what the standard printer driver for this model does - i.e. convert the text into a (proprietary) compressed raster image. 

 

Attached (within a .zip file) is a 'captured' print job, generated by printing a NotePad document (which contains just the text "Sample message"), using the standard Windows printer driver for this model.

Also within the .zip file is an analysis of the captured print job.

 

I very much doubt that you'd be able to emulate what this print job does, because the raster compression mechanism, and 'driver configuration' parameters, etc., do not appear to have any publically-available documentation.

HP Recommended

 

 

Hi,

 

Greetings.

 

Thanks for your support.

 

I am sending below commands to printer:

 

#define ESCAPE "\033"
#define COMMAND_JOB_START ESCAPE "%-12345X" ESCAPE "E" ESCAPE "&l0E" ESCAPE "&l0F" ESCAPE "&a0L" ESCAPE "&a0M"
#define COMMAND_JOB_STOP ESCAPE "E" ESCAPE "%-12345X"
#define COMMAND_TEXT_START "LB"
#define COMMAND_TEXT_STOP "\003;"
#define TEXT_TO_PRINT "Sample Message"


strcpy( buffer, COMMAND_JOB_START COMMAND_TEXT_START TEXT_TO_PRINT COMMAND_TEXT_STOP COMMAND_JOB_STOP);

 

Is the sequence right ? Or should I have to modify to get sample message print?

 

 

Best regards.

 

HP Recommended

>> ... Is the sequence right ? Or should I have to modify to get sample message print? ...

 

No.

Have you looked at the sample file (and its anaysis) that I attached in a previous response?

 

As I tried to explain before, I don't think that this printer understands ANY plain text, therefore your

COMMAND_TEXT_START

TEXT_TO_PRINT

COMMAND_TEXT_STOP sequences will have no meaning.

 

You have to convert the text into an encapsulated, compressed, raster image - but (as the compression algorithm does not appear to be documented) I shouldn't think that this would be at all easy.

 

Get a different printer (one that supports PCL5).

HP Recommended

Does PCL5 Laserjet printer supports the sequence of commnds I have mentioned?

 

Can I get a sample print on PCL5 printer? 

HP Recommended

>> ... Does PCL5 Laserjet printer supports the sequence of commnds I have mentioned? ...

>> ... Can I get a sample print on PCL5 printer? ...

 

Assuming that I'm interpreting your C code correctly, your sample will probably not print anything on a PCL5 printer.

 

I've hand-crafted a snip01.pcl file which contains what I think your code will generate; analysis of this PCL shows:

 

Offset: dec  Type                   Sequence          Description
-----------  ---------------------  ----------------  ----------------------------------------------------

0000000000   PCL Parameterised      <Esc>%-12345X     Universal Exit Language (UEL)
             Comment                                  Switch language to PJL
             Comment                                  Switch language to PCL
0000000009   PCL Simple             <Esc>E            Printer Reset
0000000011   PCL Parameterised      <Esc>&l0E         Top Margin (0 lines)
0000000016   PCL Parameterised      <Esc>&l0F         Text Length (0 lines)
0000000021   PCL Parameterised      <Esc>&a0L         Left Margin (column 0)
0000000026   PCL Parameterised      <Esc>&a0M         Right Margin (column 0)
0000000031   Data                                     LBSample Message[03]
0000000048   PCL Simple             <Esc>E            Printer Reset
0000000050   PCL Parameterised      <Esc>%-12345X     Universal Exit Language (UEL)
             Comment                                  Switch language to PJL

The .pcl file (and the analysis text) are attached within  .zip file.

 

The reasons why it won't print anything are:

 

  • The top margin is set to zero lines, so the text will 'print' at the top of the page - but this is within the 'unprintable region' on most (all?) LaserJet printers, so nothing will be seen.
  • The right margin is set to zero columns, so the width of the text area is effectively zero! Again, nothing will be printed.
HP Recommended

I've hand-crafted a modified  snip01a.pcl file, which contains changes to the top and right margin values; analysis of this PCL shows:

 

Offset: dec  Type                   Sequence          Description
-----------  ---------------------  ----------------  ----------------------------------------------------

0000000000   PCL Parameterised      <Esc>%-12345X     Universal Exit Language (UEL)
             Comment                                  Switch language to PJL
             Comment                                  Switch language to PCL
0000000009   PCL Simple             <Esc>E            Printer Reset
0000000011   PCL Parameterised      <Esc>&l10E        Top Margin (10 lines)
0000000017   PCL Parameterised      <Esc>&l0F         Text Length (0 lines)
0000000022   PCL Parameterised      <Esc>&a0L         Left Margin (column 0)
0000000027   PCL Parameterised      <Esc>&a80M        Right Margin (column 80)
0000000033   Data                                     LBSample Message[03]
0000000050   PCL Simple             <Esc>E            Printer Reset
0000000052   PCL Parameterised      <Esc>%-12345X     Universal Exit Language (UEL)
             Comment                                  Switch language to PJL

This .pcl file (and the analysis text) are attached within another .zip file.

 

This will print the text:

 

LBSample Message

on the page.

 

I suspect that you were thinking that the "LB" (and the terminating hexadecimal 03 (octal 003) value were neccessary to print some text, but what happens is that the characters LB are printed directly in front of the sample message text and the 0x03 character has no effect, since it is not a graphic character in (most) PCL fonts.

 

LB is a HP-GL/2 command, and 0x03 is the default terminator for text using this command.

But the job is in PCL mode, you haven't switched to HP-GL/2 mode (and why would you need to anyway to print simple text?). 

HP Recommended

Note that the COMMAND_JOB_START def does NOT contain an ENTER LANGUAGE pjl command.

HP Recommended

>> ... Note that the COMMAND_JOB_START def does NOT contain an ENTER LANGUAGE pjl command ...

 

Agreed.

The PJL ENTER LANGUAGE = PCL command should strictly be present, in order to change the printer from PJL mode and to invoke entry to the PCL interpreter.

 

But most Laserjet devices will automatically switch to the PCL personality if an Escape control-code character is encountered whilst in PJL mode.

 

There are a number of other things 'wrong' with the sample PCL which I didn't mention before, all related to what would be considered initialising the device into a known state.

For example, no page size is specified, nor is a font selected, so (in both cases) the result will depend on what is currently set on the printer as the power-on (user) default settings.

Archived This topic has been archived. Information and links in this thread may no longer be available or relevant. If you have a question create a new topic by clicking here and select the appropriate board.
† The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the <a href="https://www8.hp.com/us/en/terms-of-use.html" class="udrlinesmall">Terms of Use</a> and <a href="/t5/custom/page/page-id/hp.rulespage" class="udrlinesmall"> Rules of Participation</a>.