How to call printer in php program

angryTom
Release: 2023-02-27 22:48:01
Original
11163 people have browsed it

How to call printer in php program

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:

Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!