Is it possible to access a local printer using TCP / IP sockets in PHP?

I know that PHP has its own PECL to do this , but I am currently using PHP 5.4, and php_printer.dll not compiled for this version.

+6
source share
2 answers

PECL may have a few old things, php_printer.dll is almost out of date. In addition, since PHP is a scripting language, it is incredibly difficult to access hardware functions (such as a printer) directly. Your best bet is to find or write printer access functions as C ++ and run the script using system () ;, Good luck!

+2
source

Printing directly from PHP through TCP / IP sockets requires a lot of work, especially in a Windows environment, without a Printer extension or a good library.

From the documentation:

Windows users must include php_printer.dll inside php.ini in order to use these functions. The DLL for this PECL extension is currently unavailable.

So, you can try to download php_printer.dll precompiled binary for PHP 5.3 from http://downloads.php.net/pierre/ and use it. It will probably work with PHP 5.4 too. If not, you must compile PHP from the source in order to use the Windows extension.

0
source

All Articles