mike42 / escpos-php

PHP library for printing to ESC/POS-compatible thermal and impact printers
Other
2.58k stars 863 forks source link

My test print does not occur. Code seems to stop for me at $profile = CapabilityProfile::load('default'); #1140

Closed chris0727 closed 2 years ago

chris0727 commented 2 years ago

Hi Mike and the folks who maintain this library. I am both appreciative and thrilled with all the heavy lifting it does. Will be even more so when I get to the logo image part :D

I'm in the early stages after installing and perhaps I'm missing something, but I am unable to do a simple print test:

use Mike42\Escpos\PrintConnectors\NetworkPrintConnector;
use Mike42\Escpos\Printer;
if(isset($_POST["print_test_page"]))
{
  //Some validation and db code to get the chosen printer specs
  $ip_address = $pos_printer[0]["ip_address"]; //returns 192.168.0.92
  $connector = new NetworkPrintConnector($ip_address, 9100);
  $printer = new Printer($connector);
  $printer->text("Hello world\n");
  $printer->cut();
  $printer->close();
}

Notes: Arkscan 8100use printers, I believe they are Epson style as they work with the same pulse/cut codes I have achieved network printing, cutting, & open drawers using fsockopen and fwrite separately before I found this library, so I know the printers work and are networked properly. I installed this library with Composer along with php-intl and imagick, as directed

The code seems to stop for me @PrintConnector function (in Printer.php):

/* Set connector */
$this -> connector = $connector;
//echo 'got here1'; //shows up**
/* Set capability profile */
if ($profile === null) {
    $profile = CapabilityProfile::load('default');
}
//echo 'got here2'; //does not show up, so nothing happening at this point

[EDIT: I edited some of my question here as I see where my debugging was incorrect, the 'default' profile is constructed correctly in CapabilityProfile class, but still $profile in above is not getting defined and everything stops there]

Sorry, my class writing skills aren't as advanced yet, so maybe I'm off base? If so, am I doing something wrong elsewhere or could there be some other dependency I'm missing?

Thanks in advance, Chris

chris0727 commented 2 years ago

PHP Version 7.4.3, Apache2 on Ubuntu Server (sorry should have mentioned)

chris0727 commented 2 years ago

I rarely ever ask or report issues anymore because, sure enough, I'll figure it out soon after. When I installed late last night, I didn't restart the apache server so the php-intl didn't take effect. Duh, but may help somebody else. Hello World just printed. Can't wait to learn more and dive into this now. Sorry for using the webspace! Cheers