Check Email with Email-Node and Print PDF Attachement

Hi,

I am searching for a solution to check Emails and print PDFs via the CUPS Printer on a Raspbian.

I am already able to check the Mailbox, but how can I forward the PDF Attachment to a Printer?

image

Br,
Johannes

THe server running Node-RED needs to have a print capability set up in the OS I think.

Then you could at least save the PDF to a temporary file and use the exec node to send that file to the printer.

FWIW.

For our finance teams in work:
I (using azure), retrieve all emails with PDF attachments addressed to our finance department, then

  • Save the PDF temporarily
  • Copy the PDF to \\print-server\PrinterShareName

This does not need the printer to be installed on the computer.

I should note, this is a windows setup, and placing a file to the UNC path of the printer adds it to the printer servers spool.

As long as its a PDF, it will print natively - without any need for a print driver or software

might be worth finding out, if you can do the same in Raspbian?

I was perhaps a bit brief in my explanation (yes, I know, unusual for me!).

You are right of course that there are various ways to use networked printers as well as local ones. A lot depends on what the printer supports of course.

This page has the details of out to output a PDF to a printer via CUPS:

Command-Line Printing and Options (cups.org)

1 Like

CUPS is running, I can already print from the command line.

Need to check how I can save the PDF Attachment in Node Red.

Exec and deleting after printing shouldnt be an issue.

You should be able to use the file write node.

Just extract the buffer portion from your message (assumably a base64 string), and pass that as payload to the file write node.

Set encoding to base64 - again I assume that is what you get
uncheck add newline

You can set the filename in a msg object also

Screenshot 2023-04-23 at 07.44.44

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.