Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parallel Port Issue #277

Closed
Jubi11 opened this issue Jan 30, 2017 · 3 comments
Closed

Parallel Port Issue #277

Jubi11 opened this issue Jan 30, 2017 · 3 comments

Comments

@Jubi11
Copy link

Jubi11 commented Jan 30, 2017

Hello, I have an strange problem using parallel port connection. My printer (Epson TM-U220) works fine, I have tried, for example, printing from notepad and other software and It works fine. But the problem is when I try to use escpos with parallel port. I get the next error:

   "Warning: file_put_contents() expects parameter 1 to be a valid path"

I don't know why because I tried testing the parallel port with command line and it works perfectly.

     echo "Hello World!!" > LPT1 (this works perfect using command line)

I don't know if the problem is the operative system ( Windows XP Pro SP3) or if there is a problem with the shared printer...

I was thinking the problem is the Windows XP because I can't use command line to connect to a printer that is shared, for example:

         net use \\ComputerName\PrinterName 

Command above sends that I can't access to network location even if the printer is already shared.

But the thing is why if this command works:

          echo "Hello World!!" > LPT1

The next code don't work? :

<?php
require __DIR__ . '/../../autoload.php';
use Mike42\Escpos\Printer;
use Mike42\Escpos\PrintConnectors\WindowsPrintConnector;
$connector = new WindowsPrintConnector("LPT1");
/* Print a "Hello world" receipt" */
$printer = new Printer($connector);
$printer -> text("Hello World!\n");
$printer -> cut();
/* Close printer */
$printer -> close();

?>

PHP file shows this:

      Warning: file_put_contents() expects parameter 1 to be a valid path

I have already tried the permission thing and a huge of stuff and nothing.
I have used escpos in the past but using windows 7 and windows 10 and only with usb printers.

Thank you so much.

@mike42
Copy link
Owner

mike42 commented Jan 30, 2017

I'll make a note to check the connector code, could be a bug.

Can you try using new FilePrintConnector("LPT1")? It's a simpler way of doing the same.

@Jubi11
Copy link
Author

Jubi11 commented Jan 30, 2017

@mike42 You are awesome. FilePrintConnector("LPT1") resolved the problem.
Thank you for the help and thank you for escpos.

@Jubi11 Jubi11 closed this as completed Jan 30, 2017
mike42 added a commit that referenced this issue Feb 5, 2017
This pull request corrects a bug in the `WindowsPrintConnector` when names like `LPT1` or `COM1` are used.

The `file_put_contents()` call here is incorrect, causing the print to fail.
@karthickyathav
Copy link

@mike42 i am using EPSON TM-T81 model receipt printer i tried your php library for printing when i run the script with the correct port of the printer it returns blank page with no error but i cannot see any receipt coming out of my printer. do u have php library for EPSON TM-T81 receipt printer???

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

No branches or pull requests

3 participants