Skip to content

Conversation

wahyubaskara
Copy link

This pull request introduces a new feature that allows for configurable image printing commands, specifically for ESC/P printers.

Summary

Previously, QZ-Tray used command (ESC *) for printing images to ESC/P printers. This change introduces support for two additional, widely-used image printing commands: GS v 0 and GS ( L.

The primary goal is to offer better performance for image printing with alternative commands.

Key Changes

  • Configurable Image Commands: A new imageEncoding option has been added to the print configuration. This allows users to specify which command set to use for image printing.
    • ESC_STAR (default): The original ESC * command.
    • GS_V_0: The GS v 0 command.
    • GS_L: The GS ( L command.
  • New Encoders:
    • GsV0Encoder.java: Implements the logic for the GS v 0 command.
    • GsLEncoder.java: Implements the logic for the GS ( L command.

How to Use

To use one of the new image printing commands, add the imageEncoding option to your printing configuration. For example:

{
    type: 'raw',
    format: 'image',
    flavor: 'file',
    data: fileUrl,
    options: { language: 'ESCPOS', imageEncoding: 'GS_L' },
}

If the imageEncoding option is not specified, the system will default to ESC_STAR to maintain backward compatibility with existing setups.

@tresf
Copy link
Contributor

tresf commented Aug 6, 2025

@wahyubaskara thanks for the PR!

I'll probably change esc_star with esc_asterisk to avoid name confusing with future Star Micronics Star Line Mode Commands.

It will be some time before I can do a proper review. I may move some components or API names around as part of this effort. I assume you're OK if I use your branch for this effort?

@wahyubaskara
Copy link
Author

Yes, feel free to use my branch and make any changes needed

@tresf
Copy link
Contributor

tresf commented Sep 2, 2025

Sorry for the delay on this. I've approved the workflows so you can get the artifacts. I may remove the artifact creation from this PR as it's unrelated to this feature.

I have not yet begun reviewing the code, but it's on the todo list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants