kofel/gutenberg

With the *kofel/gutenberg* library you can feel that PHP likes to have printing support.

dev-master 2016-05-05 07:54 UTC

This package is not auto-updated.

Last update: 2024-09-14 16:18:53 UTC


README

When Gutenberg in 15 century has invented printing, knowledge has become more common. With the kofel/gutenberg library you can feel that PHP likes to have printing support.

Implementation of Gutenberg relies on two things: Printer and Printable. It's easy visualisation to real world, because there we also have printer and document which we want to print. At this moment library has support only for CUPS printers and printable gLabels file type.

USAGE

Simple proof of usage:

<?php
use Gutenberg\Printable\gLabelsPrintable;
use Gutenberg\Printer\CUPS\PrinterProfile;
use Gutenberg\Printer\CUPSPrinter;

$data = [
    [
        'sn' => 12345678,
        'text' => 'KUBA'
    ]
];

$printable = new gLabelsPrintable(new \SplFileInfo($argv[1]), $data);
$profile = new PrinterProfile('PDF');
$printer = new CUPSPrinter();
$printer->enqueue($printable,$profile);

Important! Please note that CUPSPrinter requires also PrinterProfileInterface instance, because we have to specify where CUPS have to enqueue document.

TODO

  • Tests :)
  • More printers, ex.: wkhtmltopdf, rendering twig templates, console
  • More printables, ex.: json