rawilk / laravel-printing

Direct printing for Laravel apps.
https://randallwilk.dev/docs/laravel-printing
MIT License
438 stars 71 forks source link

Cups #92

Open vatsake opened 4 months ago

vatsake commented 4 months ago

1️⃣ Is this something that is wanted/needed? Did you create an issue / discussion about it first? Should solve #74, #81

2️⃣ Does it contain multiple, unrelated changes? Please separate the PRs out. Nope.

3️⃣ Does it include tests, if possible? (Not a deal-breaker, just a nice-to-have) Currently I modified the existing tests, will add more if needed.

4️⃣ Please include a thorough description of the improvement and reasons why it's useful. Removes the smalot/cups-ipp dependency.

5️⃣ Thanks for contributing! 🙌

Some side notes.

vatsake commented 4 months ago

It isn't the best API at the moment. Could be better. Custom page print-job example:

use Rawilk\Printing\Api\Cups\Types\Collection;
use Rawilk\Printing\Api\Cups\Types\Member;
use Rawilk\Printing\Api\Cups\Types\Primitive\Integer;
use Rawilk\Printing\Facades\Printing;

Printing::newPrintTask()
    ->printer('http://.../printers/...')
    ->content('hello world', 'text/plain')
    ->option(
        'media-col',
        new Collection([
            'media-size' => new Member(
                new Collection([
                    'x-dimension' => new Member(new Integer(9200)),
                    'y-dimension' => new Member(new Integer(1800)),
                ])
            ),
        ])
    )
    ->orientation('reverse-portrait')
    ->send();
fkoehl commented 3 months ago

Thank you @vatsake, it fixes #74 for me!

@rawilk, will you consider approving this PR?

I'm willing to help to do some commits rebasing/polishing if needed.