How does the php program call the printer
php can use the php_printer extension to control the printer.
1. Configuration
php running environment is installed correctly (Apache|Nginx PHP)
Download the php_printer.dll extension http that corresponds to the php version: //windows.php.net/downloads/pecl/snaps/printer/0.1.0-dev/
Add the extension file to the ext directory
Edit php.ini and add extension=php_printer.dll ;
2. Use
1. Basic code structure:
The above is the basic code structure. If printer_start_doc and printer_start_page are not specified, The printer will not print.
2. Introduction to printing methods of specific text and graphics
Initial setting of the printer: printer_set_option, you can set the printing mode, doc title, number of print copies, paper format, etc., refer to printer_set_option document.
Create a font: $font = printer_create_font('simsun', font height, font width, font thickness, whether it is italic, whether to underline, whether to add strikethrough, direction);
Specific See (http://docs.php.net/manual/da/function.printer-create-font.php). Before printing text, you must first select the font printer_select_font($handle, $font);
Use printer_draw_text($handle,'text to be printed', starting x, starting y);
For more PHP-related knowledge, please visitPHP中文网!
The above is the detailed content of How to call printer in php program. For more information, please follow other related articles on the PHP Chinese website!