Skip to content

Conversation

@gilbertfl
Copy link

@gilbertfl gilbertfl commented May 30, 2025

This PR backports the QR code parsing and rendering routines developed for the gilbertfl/escpos-netprinter project.

It resolves the feature request in #59. Since it is compatible with PHP 8.4, this PR should supersede the PHP8 conversion from the PR related to #76 and resolve the problem in #82.

To do the rendering of the QR codes, a new dependency is introduced: the chillerlan/php-qrcode library, which itself depends on composer, mbstring and imagick.

This PR has been cut down to only the files that are necessary, since the escpos-netprinter project is more of a derivative than a fork. This note is important since I DO NOT propose to remove any files in escpos-tools (like the licence or CONTRIBUTING files).

The only binary blob in this PR is the "NoQR.jpg" file: this is a QR code that encodes the string "No QR code here!". This QR code is substituted when a badly-behaving input demands printing a code before it's data has been stored. It is used esc2html.php at line 140.

Nicola Giancecchi and others added 30 commits February 5, 2023 19:20
Container docker avec
 - flask-socketio
 - php et escpos-tools
Installation instructions
Francois-Leonard Gilbert and others added 29 commits June 10, 2024 19:13
Partially deal with other FS subcommands
Correct bugs discovered by testing.
…rom-pos-systems' into 1-deal-with-pre-print-requests-from-pos-systems
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should not be deleted.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should not be deleted.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should not be deleted.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be removed from the project, since composer generates it at install time.


error_log("esc2html starting", 0);
// Usage
if (!isset($argv[1])) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Argument parsing is modified to add a --debug option.

This is to help debug any file parsing problems.

private $y1 = null;
private $y2 = null;

private $data = "";
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since $data and $datasize are protected members of the superclass, they must not be redeclared here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The placeholder for all 2D codes except for QR codes.

margin: 1em;
/*margin: 1em;*/
padding: 1em;
min-width: 28em;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed since I needed the width to be exactly 80mm.


//To implement GS ( k <Function 182>, Transmit the size information of the symbol data in the symbol storage area
public function printQRCodeStateInfo(){
//TODO: implement the status info - this is probably unnecessary for the ESCPOS-netprinter project.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably not useful at all for escpos-tools, since there is no bidirectional communication going on.

$qroptions->versionMax = 40;
break;
case 51:
# TODO: decide what to do if someone wants a MicroQR code
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MicroQR codes are not supported in chillerlan/php-qrcode

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.

1 participant