michaelrsweet / pappl

PAPPL - Printer Application Framework
https://www.msweet.org/pappl
Apache License 2.0
309 stars 49 forks source link

Hot folder print option ? #152

Closed Waxhaw closed 3 years ago

Waxhaw commented 3 years ago

Is your feature request related to a problem? Please describe. I need a way to AirPrint images to a system managing the documents. Hot folder printing is very common on specialized printers as well as big print printers like HP Indigo and Xerox Igen.

Describe the solution you'd like So if you remember TeaForCups or how the PPD Pre-filters worked. You literally had to create a generic PPD for the print size you cared about and then custom PreFilter items like this: cupsPreFilter: "application/pdf 100 pdf_filter_s6x8" cupsPreFilter: "image/jpeg 100 jpg_image_filter_s6x8" *cupsPreFilter: "image/png 100 png_image_filter_s6x8"

If the printer is optimized for that image type I just want to drop it on the hot folder. Sadly AirPrint forces any image but JPG to be a PDF document. :-(

So you have to do something like this with a filter: echo "PDF image sent" 1>> /tmp/filter.log

echo "Job ID == $1 --" 1>> /tmp/filter.log echo "client == $2 --" 1>> /tmp/filter.log echo "data type == $3 --" 1>> /tmp/filter.log echo "print copies == $4 --" 1>> /tmp/filter.log

cp $6 /data_q 1>> /tmp/filter.log.log 2>> /tmp/filter.log fileName=echo $6 | rev | cut -f 1 -d "/" | rev cat /data_q/$fileName

echo "$fileName created --" 1>> /tmp/filter.log

validate we have a PDF file

pdfimages /data_q/$fileName /data_q/$fileName -j if [ -f /data_q/$fileName-000.ppm ] then echo "ppm file" 1>> /tmp/filter.log rm /data_q/$fileName-001.ppm convert -density 300 /data_q/$fileName-000.ppm /dataq/$4$3_$1.jpg rm /data_q/$fileName chmod 777 /data_q/ mv /dataq/$4$3_$1.jpg /hotfolder/s6x8/ echo "$4$3_$1.jpg moved to print queue --" 1>> /tmp/filter.log elif [ -f /data_q/$fileName-000.jpg ] then echo "jpg file" 1>> /tmp/filter.log chmod 777 /data_q/ mv /data_q/$fileName-000.jpg /hotfolder/s6x8/$4$3$1.jpg echo "$fileName-000.jpg moved to print queue $4$3_$1.jpg --" 1>> /tmp/filter.log rm /data_q/$fileName fi

So on very large printers and specialized printers imagine a world with ZERO network interface. I've got my own highly specialized and advanced print system running on Unix/Linux. So think Shutterfly high end printers or specialized sublimation photo printers that print using 6 inch or 8 inch rolls of paper.

If you provided a simple way to put a non-networkable printer with an IPP AirPrint type of interface for a hot folder that would be a huge win.

The MAJORITY of IOT owners that install CUPS on a Raspberry Pi just so they can AirPrint to an old 'non-network' printer is huge.

Don't over think it. If the image doesn't print they will know down stream. No job to manage. No printer to configure. Give me an air interface for a mime type to a hot folder. PDF and JPG as well as a way to hook in so I'm called for conversion, color profile and managing the specialities of the printer I'm controlling.

Describe alternatives you've considered I tried Tea4CUPS but that ship has sailed and sank. Basically I'm using CUPS with PPD files and filters as shown above. CUPS is like bass fishing from a battle ship. To say it's over kill is an understatement when all I want is a JPG to toss over the wall to a custom print engine.

Additional context I'm running headless on IOT devices as they are ideal for a network AirPrint 'front end'. I've been working with Raspberry Pi devices as well as several clones.

As crazy as this request sounds, it's seems amazingly simple and so modular in function that anyone could use it.

The PPD file format and all of the cups.conf setup with all of the CUPS infrastructure is really over kill for a 'Hot Folder' option. People that have document imaging systems for any time of fax system could easily tweak this for front end routing. So say I wanted an option to validate an image or a persons credentials before I allowed them to print or save a resource?

It also would make a great debug/test option for folks. If folks tried to 'HotFolder' Air Print and that didn't work they could start looking at Avahi services or their network config. If the file shows up in a folder and then they fully configure and it doesn't produce hard copy then they know their printer is misconfigured.

TIA for reading all of this. I figured it never hurts to ask. :-)

michaelrsweet commented 3 years ago

@Waxhaw First, PDF is only used if you report PDF support and do not report support for the original format (say, "image/heif"). Current iOS isn't too smart about choosing the print format and (unfortunately) converts HEIF images to (lightly) compressed PDFs which are many times larger than the original image...

Second, you can make a printer application with PAPPL that writes to a hot folder - that is effectively what the testpappl program does to validate the print pipeline.

Third, you can use the "ippeveprinter" program that comes with CUPS to implement a hot folder printer as well, with no code. Use the "-k" (keep files) option to keep the spool files around in the hot folder.