# Check Email with Email-Node and Print PDF Attachement

**URL:** <https://discourse.nodered.org/t/check-email-with-email-node-and-print-pdf-attachement/77776>\
**Category:** General\
**Created:** [21 April 2023 07:07 UTC](https://discourse.nodered.org/t/check-email-with-email-node-and-print-pdf-attachement/77776 "2023-04-21T07:07:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ebnerjoh](https://avatars.discourse-cdn.com/v4/letter/e/ebca7d/32.png) [@ebnerjoh](https://discourse.nodered.org/u/ebnerjoh)\
**Post date:** [21 April 2023 07:07 UTC](https://discourse.nodered.org/t/check-email-with-email-node-and-print-pdf-attachement/77776/1 "2023-04-21T07:07:44Z")

</div>

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](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/8/787ce280d240339a515a97f27e59a376630f6dab.png)

Br,  
Johannes

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [21 April 2023 08:41 UTC](https://discourse.nodered.org/t/check-email-with-email-node-and-print-pdf-attachement/77776/2 "2023-04-21T08:41:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [21 April 2023 09:52 UTC](https://discourse.nodered.org/t/check-email-with-email-node-and-print-pdf-attachement/77776/3 "2023-04-21T09:52:13Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [21 April 2023 10:59 UTC](https://discourse.nodered.org/t/check-email-with-email-node-and-print-pdf-attachement/77776/4 "2023-04-21T10:59:27Z")

</div>

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)](https://www.cups.org/doc/options.html)

---

<div class="post-metadata">

**Author:** ![ebnerjoh](https://avatars.discourse-cdn.com/v4/letter/e/ebca7d/32.png) [@ebnerjoh](https://discourse.nodered.org/u/ebnerjoh)\
**Post date:** [23 April 2023 05:48 UTC](https://discourse.nodered.org/t/check-email-with-email-node-and-print-pdf-attachement/77776/5 "2023-04-23T05:48:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [23 April 2023 06:50 UTC](https://discourse.nodered.org/t/check-email-with-email-node-and-print-pdf-attachement/77776/6 "2023-04-23T06:50:49Z")

</div>

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](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/3/53e12b46d156a264ee9cd9fe8b1be6d14c24b727.png)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [7 May 2023 06:50 UTC](https://discourse.nodered.org/t/check-email-with-email-node-and-print-pdf-attachement/77776/7 "2023-05-07T06:50:59Z")

</div>

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