I've got a website with a few homemade checkout pages and a link to a payment gateway. At the moment the final confirmation page sends an HTML email with the Order details/Customer details.

Is there a way I can have my final checkout page generate a PDF invoice of the Order details/Customer details and attach it to an email that is sent to the customer and I?