Generate a PDF from an email

Hello there, I’m looking for a way to generate a PDF from an email received from Thrivecart (basically when a new sale is done). The invoice they sent is a basic HTML table, there is no PDF file stocked on their server so I will need to first convert the email to PDF then transfer it by email to my accounting software in order for the file to be added automatically in my software (then I will just need to link it to the transaction instead of download the invoice manually, upload it to the software, link to the transaction…)

I have start my flow with “Get email” link to the email account, a branch with a condition “If it’s from” and then i’m a little lost for the PDF file generation :slight_smile:

Does anybody have already achieve this kind of things and would be able to help me ? Thanks a lot

1 Like

I’m no expert, but can try to help. Could you show me what a dummy email would look like? Plain text, HTML or fully stylized emails? Also, does the Thrivecart send the data as one chunk, or individual variables/fields?

Thank you :smiling_face_with_three_hearts:

Yes, it looks like this : Spark | Sale notification: 000000001 I have inspected it and it’s just basic HTML so I guess I could just turn this as it is to a PDF but I don’t really see how :flushed:

No problem! When a Thrivecart email triggers your flow, how does the data show up in the bottom right corner (it might say Generate Sample Data)? I’m wondering if you can plug the data into a Google Doc template, which you can then use to generate a PDF, and thus, email it off as an attachment. I mean you should be able to do that anyways, but it will be neater if the data is received in an organized matter.

Yes it does generate sample data from my last email (so it’s not from thrivecart) then I have a branch with condition filter

I don’t know about google doc template but I have already see that, I will have a closer look maybe it could work

For a Thrivecart email, does the email body show up under one heading like html: or is it split up into sections? If it’s just one chunk, we’d have to someone parse the text before creating a template with dynamic variables. If each of the values in your email are split up (just like your screenshot Spark | Sale notification: 000000001) then you should be able to map them to a Google Docs template and consequently, generate a PDF that can be emailed off.

Get a Thrivecart email sent through your automation, then tap the fullscreen button in the Output:


Take a screenshot of the full output and send it to me.

You can PM if you prefer/if it contains sensitive info.

I should be able to guide you better with this info.

It’s worth considering if OP’s usecase is worth the significant complexity and associated maintenance of actually parsing the information from the email.
Though I absolutely agree it would be neater, this is not a trivial task and could very easily break if Thrivecart changes their formatting.

As far as I know, this kind of accounting software doesn’t really care about what an invoice looks like, as long as it’s in there. If that’s the case, it’s probably sufficient (and easier to maintain) to just convert the whole email (HTML) into a PDF.

@Charlene_DL please correct me if I’m wrong though!

Parsing was only brought up, if necessary, for the IMAP → Google Drive → Google Docs → PDF option. Do you know an easy way to convert an email (IMAP) into a PDF? Ideally without any additional paid software. If so, definitely relay it here!

Hmm, in principle it should be possible to create a piece that converts HTML to PDF using something like html-pdf-node (which uses the Chromium engine through puppeteer).

That doesn’t help @Charlene_DL right now, but it would be a nice addition to Activepieces long-term.
Unfortunately I don’t have the bandwidth for this now, but since this feels like a fairly common scenario perhaps it can get some love from the Activepieces team? :eyes:

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