DeX Posted August 3, 2010 Share Posted August 3, 2010 Hi guys, I'll try to explain this. I'm doing a quoting system for a building contractor and I have a dynamic purchase order created for every quote that's confirmed and it spits out all the materials they will need for each supplier. The layout of the page is exactly what I need emailed to the supplier so they can ship out the materials listed, it's your basic purchase order. I'm going to put a button on the page that sends the email to the supplier but I need to attach the purchase order displayed on the page. Preferably in PDF but it just needs to be an attached file. I know I can have the user use PRINT.... to save it as PDF and then use Outlook to email it but I'd like to automate it. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/209684-how-do-i-use-php-to-email-a-pdf-of-the-current-page/ Share on other sites More sharing options...
DWilliams Posted August 3, 2010 Share Posted August 3, 2010 You might want to look into the dompdf library: http://www.digitaljunkies.ca/dompdf/ It takes HTML and converts it into a PDF document. I used it when making my report system at work and it has worked very well for us. You could use it to generate a temporary PDF file and then use another library like phpmailer ( http://phpmailer.worxware.com/ ) to send that temp file as an attachment. It can be a bit finicky, especially if you use advanced CSS but overall it does a good job and they have a google group set up to provide support for it. Quote Link to comment https://forums.phpfreaks.com/topic/209684-how-do-i-use-php-to-email-a-pdf-of-the-current-page/#findComment-1094699 Share on other sites More sharing options...
DeX Posted August 6, 2010 Author Share Posted August 6, 2010 I looked at that and it looks like it just downloads it to your local machine, it doesn't allow me to use any sort of mailer with it. I can just click PRINT... and then Save As PDF to do the same thing. Is there maybe a way to just use the PHP mail() function to mail a HTML email version of the current page? Quote Link to comment https://forums.phpfreaks.com/topic/209684-how-do-i-use-php-to-email-a-pdf-of-the-current-page/#findComment-1096077 Share on other sites More sharing options...
DWilliams Posted August 6, 2010 Share Posted August 6, 2010 I looked at that and it looks like it just downloads it to your local machine, it doesn't allow me to use any sort of mailer with it. I can just click PRINT... and then Save As PDF to do the same thing. Is there maybe a way to just use the PHP mail() function to mail a HTML email version of the current page? With DOMPDF what you need to do is send the output to a temp file instead of streaming it to the user (I don't recall exactly how to do that but I'm fairly certain it's possible) then email that temp file to the user. As far as I know the mail() function does not support attachments so you'd have to look into another library for email. Quote Link to comment https://forums.phpfreaks.com/topic/209684-how-do-i-use-php-to-email-a-pdf-of-the-current-page/#findComment-1096097 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.