escpos-php
Public Member Functions | List of all members
Mike42\Escpos\PrintBuffers\ImagePrintBuffer Class Reference

This class renders text to small images on-the-fly. More...

Inheritance diagram for Mike42\Escpos\PrintBuffers\ImagePrintBuffer:
Inheritance graph
[legend]
Collaboration diagram for Mike42\Escpos\PrintBuffers\ImagePrintBuffer:
Collaboration graph
[legend]

Public Member Functions

 flush ()
 Cause the buffer to send any partial input and wait on a newline. More...
 
 getPrinter ()
 Used by Escpos to check if a printer is set.
 
 setPrinter (Printer $printer=null)
 Used by Escpos to hook up one-to-one link between buffers and printers. More...
 
 writeText (string $text)
 Accept UTF-8 text for printing. More...
 
 writeTextRaw (string $text)
 Accept 8-bit text in the current encoding and add it to the buffer. More...
 
 setFont (string $font)
 Set path on disk to TTF font that will be used to render text to image, or 'null' to use a default. More...
 
 setFontSize (int $fontSize)
 Numeric font size for rendering text to image.
 

Detailed Description

This class renders text to small images on-the-fly.

It attempts to mimic the behaviour of text output, whilst supporting any fonts & character encodings which your system can handle. This class currently requires Imagick.

Member Function Documentation

◆ flush()

Mike42\Escpos\PrintBuffers\ImagePrintBuffer::flush ( )

Cause the buffer to send any partial input and wait on a newline.

If the printer is already on a new line, this does nothing.

Implements Mike42\Escpos\PrintBuffers\PrintBuffer.

◆ setFont()

Mike42\Escpos\PrintBuffers\ImagePrintBuffer::setFont ( string  $font)

Set path on disk to TTF font that will be used to render text to image, or 'null' to use a default.

ImageMagick will also accept a font name, but this will not port as well between systems.

Parameters
string$fontFont name or a filename

◆ setPrinter()

Mike42\Escpos\PrintBuffers\ImagePrintBuffer::setPrinter ( Printer  $printer = null)

Used by Escpos to hook up one-to-one link between buffers and printers.

Parameters
Printer | null$printerNew printer

Implements Mike42\Escpos\PrintBuffers\PrintBuffer.

◆ writeText()

Mike42\Escpos\PrintBuffers\ImagePrintBuffer::writeText ( string  $text)

Accept UTF-8 text for printing.

Parameters
string$textText to print

Implements Mike42\Escpos\PrintBuffers\PrintBuffer.

◆ writeTextRaw()

Mike42\Escpos\PrintBuffers\ImagePrintBuffer::writeTextRaw ( string  $text)

Accept 8-bit text in the current encoding and add it to the buffer.

Parameters
string$textText to print, already the target encoding.

Implements Mike42\Escpos\PrintBuffers\PrintBuffer.


The documentation for this class was generated from the following file: