Download the PHP package trupermax/print-agent without Composer

On this page you can find all versions of the php package trupermax/print-agent. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package print-agent

trupermax/print-agent

Librería PHP para comunicarse con el servicio local Print Agent desde aplicaciones web o Laravel.

Instalación

Uso básico


PrintAgent

Constructor

Métodos

status()

Retorna el estado del servicio.

printers()

Retorna la lista de impresoras disponibles.

printPDF()

Imprime un PDF a partir de un string en Base64.

printZPL()

Imprime una etiqueta ZPL en una impresora Zebra.

printEscPos()

Imprime bytes ESC/POS en una impresora térmica. Recibe el string binario que retorna EscPos::build().

escpos()

Método de fábrica que retorna una nueva instancia del builder EscPos.


Referencia de comandos EscPos

Todos los métodos retornan $this para encadenarse, excepto build() que retorna el string binario final.

Método Descripción
init() Inicializa la impresora (resetea configuración)
align(string) Alineación: 'left', 'center', 'right'
bold(bool) Negrita: true / false
underline(bool) Subrayado: true / false
fontSize(int) Tamaño de fuente: 1 (normal) al 4 (cuádruple)
text(string) Agrega texto sin salto de línea
textLine(string) Agrega texto con salto de línea
line(string, int) Línea separadora (defecto: 42 guiones)
feed(int) Avanza el papel N líneas (defecto: 1)
row(string, string, int) Dos textos en la misma línea: izquierda y derecha
columns(array, array) Tabla con N columnas de ancho y alineación individual
qr(string, int, string) Código QR generado por la impresora
barcode(string, string, int, int, string) Código de barras generado por la impresora
cut(bool) Corta el papel: parcial (defecto) o completo
raw(array) Agrega bytes ESC/POS crudos directamente
build() Retorna el string binario final para enviar al endpoint

Detalle de cada comando

init()

Inicializa la impresora y resetea todos los ajustes. Siempre llámalo primero.

align(string $value)

bold(bool $enabled)

underline(bool $enabled)

fontSize(int $size)

text(string $value)

Agrega texto sin salto de línea.

textLine(string $value)

Agrega texto seguido de un salto de línea.

line(string $char = '-', int $length = 42)

feed(int $lines = 1)

row(string $left, string $right, int $width = 42)

Imprime dos textos en la misma línea rellenando el espacio entre ellos. Útil para pares clave-valor.

columns(array $cells, array $defs)

Imprime N columnas con ancho y alineación individual. Ideal para tablas de productos.

Cada definición de columna:

Campo Tipo Defecto Descripción
width int requerido Ancho en caracteres
align string 'left' Alineación: 'left', 'center', 'right'

La suma de todos los anchos debe coincidir con el ancho de la impresora (normalmente 42 para papel de 80mm).

qr(string $data, int $size = 4, string $errorLevel = 'M')

Genera un código QR usando el hardware de la impresora.

errorLevel Corrección
'L' 7% — más compacto
'M' 15% — uso general (defecto)
'Q' 25% — ambientes con suciedad
'H' 30% — máxima corrección

barcode(string $data, string $type = 'CODE128', int $height = 60, int $width = 2, string $textPosition = 'below')

Genera un código de barras usando el hardware de la impresora.

Tipos de código de barras soportados:

Tipo Uso típico
'CODE128' Uso general, alfanumérico (defecto)
'CODE39' Inventario, industria
'CODE93' Variante compacta de CODE39
'EAN13' Productos retail (13 dígitos)
'EAN8' Productos pequeños (8 dígitos)
'UPC-A' Retail USA (12 dígitos)
'UPC-E' Versión comprimida de UPC-A
'ITF' Cajas y logística
'CODABAR' Bibliotecas, sangre, courier

cut(bool $partial = true)

raw(array $bytes)

Agrega bytes ESC/POS crudos. Útil para comandos avanzados no cubiertos por el builder.

build()

Retorna el string binario final con todos los bytes acumulados para enviar al endpoint.


Ejemplo completo — ticket con tabla y QR

El ejemplo usa collect() de Laravel. Si usas PHP puro, reemplázalo con un foreach para encontrar la impresora por defecto.


Desarrollo local y pruebas


All versions of print-agent with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package trupermax/print-agent contains the following files

Loading the files please wait ...