PDF generation at checkout confirmation step

Hi everybody,

I would like to generate some PDF out of the order data of the customer and I would like to provide this PDF download link at the checkout confirmation step. Do you have any hints/tipps on how to implement this requirement? I have checked the Sylius Plugin list, but haven’t found anything.

My current approach would be:

  • Create some custom service class to generate PDF with some library (mpdf, etc.)
  • Adapt the Checkout confirmation view adding some link to some PDF generation endpoint with a given order id

What do you think?

Thanks for feedback.

Response copied from Slack:

First of all - it will be quite better to generate PDF right after Order is created rather than making your customer do it. This will give you control over performance because you know exactly when it’s created.In terms of implementation, SyliusInvoicingPlugin might be a good inspiration for you. Create a listener that will dispatch your custom GenerateSomePdf action after order is created/paid and configure it in winzou_state_machine

    winzou_state_machine:
    sylius_payment:
        callbacks:
            after:
                sylius_invoicing_plugin_payment_complete_producer:
                    on: ['complete']
                    do: ['@sylius_invoicing_plugin.event_producer.order_payment_paid', '__invoke']
                    args: ['object']

You don’t need any 3rd party solution (only sylius/sylius )

Thanks to Martin Czech.