mike42 / escpos-php

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

Printer tested: Xprinter XP-365B #592

Closed sambonuruddeen closed 6 years ago

sambonuruddeen commented 6 years ago

I have used the code with this printer model Xprinter_XP-365B

mike42 commented 6 years ago

Thanks for reporting. Were you able to print images on the printer via the bitImage() method?

sambonuruddeen commented 6 years ago

I am able to print images via the bitImage() method. Everything works perfectly.

On Sat, Jun 23, 2018 at 3:33 AM Michael Billington notifications@github.com wrote:

Thanks for reporting. Were you able to print images on the printer via the bitImage() method?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mike42/escpos-php/issues/592#issuecomment-399624072, or mute the thread https://github.com/notifications/unsubscribe-auth/AUYjBjw8QdALZQ7RFECL2M5_-rTMmwOKks5t_ajzgaJpZM4UvS_j .

diegoletelierr commented 5 years ago

I have used the code with this printer model Xprinter_XP-365B

How did you manage to print? I installed the drivers and executed the initial code (Hello World), it manages to put the document in the queue of impressions but it does not print anything. Thanks.

image

sambonuruddeen commented 5 years ago

Try this:

require DIR . '/vendor/mike42/escpos-php/autoload.php';

//use Mike42\Escpos\PrintConnectors\FilePrintConnector;

use Mike42\Escpos\Printer; use Mike42\Escpos\PrintConnectors\WindowsPrintConnector;

try {

include 'php_action/core.php';

$productId = $_GET['productId'];

//Test if barcode exists

$bcSQL = "SELECT product_name, barcode FROM product WHERE product_id=$productId"; $bcQR = $connect->query($bcSQL); $bcRES = $bcQR->fetch_assoc();

// Enter the share name for your USB printer here
$connector = new WindowsPrintConnector("Xprinter_XP-365B");
$printer = new Printer($connector);

//* Barcodes */

//$barcodes = Printer::BARCODE_UPCA;

$printer -> setBarcodeHeight(80);

$printer -> feed(1);
$printer -> text(ucfirst($bcRES['product_name']).": ".$bcRES['barcode'] . "\n");
$printer -> setJustification(Printer::JUSTIFY_CENTER);
$printer -> barcode($bcRES['barcode']);
$printer -> feed(10);

$printer -> cut(); $printer -> close();

} catch(Exception $e) { echo "Couldn't print to this printer: " . $e -> getMessage() . "\n"; }

icehaunter commented 5 years ago

Hello! Did you get it to print labels or only receipts?

sambonuruddeen commented 5 years ago

I only printed receipts.

steph6u commented 4 years ago

Hi, I am using Xprinter XP-365B on Windows 10. I am using the windows-usb.php sample code with my shared printer name replaced in the code. Script runs without notice or error, but printer does not print anything. Running copy script in command prompt also does not print. No errors. Please help. Thanks.

sambonuruddeen commented 4 years ago

Did you install the Xprinter driver?

steph6u commented 4 years ago

Yes, but I have also uninstalled it to use Generic / Text Only as per Mike's docs. Windows test print works on xprinter, but not on the Generic / Text Only driver. I see it come up split second on the printer queue, then gone, but nothing printed. Thanks for taking the time.

xMoho commented 3 years ago

@sambonuruddeen Hi, did you manage to cut receipts with that printer? The function cut() doesn't work in my case. (Without any error code) I also tried setting cut after print from printer driver with no luck.

sambonuruddeen commented 3 years ago

@sambonuruddeen Hi, did you manage to cut receipts with that printer? The function cut() doesn't work in my case. (Without any error code) I also tried setting cut after print from printer driver with no luck.

I was not able to cut receipts because the printer I used doesn't support receipt cutting

xMoho commented 3 years ago

@sambonuruddeen Hi, did you manage to cut receipts with that printer? The function cut() doesn't work in my case. (Without any error code) I also tried setting cut after print from printer driver with no luck.

I was not able to cut receipts because the printer I used doesn't support receipt cutting

Ouch, you are totaly right... this printer does not have auto-cutting. 😞 It was my bad for not reading the entire product description so I deserve it. 😅

Thank you so much!

MatthK commented 3 years ago

Yes, but I have also uninstalled it to use Generic / Text Only as per Mike's docs. Windows test print works on xprinter, but not on the Generic / Text Only driver. I see it come up split second on the printer queue, then gone, but nothing printed. Thanks for taking the time.

I have the exact same problem. I have installed the printer driver, and tried the Hello World. It quickly shows up in the print queue, but nothing gets printed, and no error message shows up. I can print a test print from the printer preferences page though. Did you ever get it to work?

steph6u commented 3 years ago

Yes, but I have also uninstalled it to use Generic / Text Only as per Mike's docs. Windows test print works on xprinter, but not on the Generic / Text Only driver. I see it come up split second on the printer queue, then gone, but nothing printed. Thanks for taking the time.

I have the exact same problem. I have installed the printer driver, and tried the Hello World. It quickly shows up in the print queue, but nothing gets printed, and no error message shows up. I can print a test print from the printer preferences page though. Did you ever get it to work?

Unfortunately, no. I haven't been able to get back to it. It would be great if someone can share a solution for this. My printer has just been sitting since.

Koxal76 commented 2 years ago

i has same troubles (no errors and no print). But when i set switches 1=OFF, 2=ON, the printer work.