Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Sibren 35 posts 187 karma points
    Jul 28, 2021 @ 06:33
    Sibren
    0

    PDF invoice generation

    Hi,

    Is there a (simple) way to attach the invoice as a PDF to the email?

    Regards, Sibren

  • Matt Brailsford 3204 posts 16959 karma points MVP 8x c-trib
    Jul 28, 2021 @ 08:02
    Matt Brailsford
    1

    Hi Sibren,

    I guess it depends on your definition of simple 😁

    You can hook into the email sending pipeline as outlined here https://vendr.net/docs/core/1.8.0/key-concepts/pipelines/ and create your own AttachPdfInvoiceTask task to read the current HTML for the email (which will be passed in a context argument) about to be sent, then use a PDF generation library to generate the PDF and add it to the emails attachement.

    You'd then want to register the task just before the email get's sent

    composition.WithSendEmailPipeline()
        .InsertBefore<SendSmtpEmailTask, AttachPdfInvoiceTask>();
    

    Hope this helps

    Matt

  • Sibren 35 posts 187 karma points
    Jul 28, 2021 @ 08:47
    Sibren
    0

    Hi Matt,

    Thanks. I was hoping for even more simpler, but this'll do!

    Regards.

Please Sign in or register to post replies

Write your reply to:

Draft