Hi @orahdev,
Thanks for contacting us,
I hope you are doing well, Can you please let me know which PHP version you are using?
Thanks & Regards
WP Experts Support Team
Hello @hamza1010 ,
Thank you for your response,
I’m using php version 7.4
Best regards,
Hi @orahdev,
Sorry for the delay, we are unable to replicate the issue on our staging site.
It is possible if you can share the screencast video of this issue?
Thank you
Hello @hamza1010 ,
Thank you for your response !
In function.php I’m trying to convert the content of my email into pdf.
I made a function that allows to retrieve the content of the email and put it as an attachment.
It works correctly however the attachment is therefore in html format.
When I try to convert it to pdf using your plugin I have an empty pdf.
Here is my function:
function add_attachment( $phpmailer )
if (strpos($phpmailer->Subject, 'New order') !== false) {
$body = $phpmailer->Body;
$filename = 'email_content_' . time() . '.pdf';
$test=wp_objects_pdf($body);
$phpmailer->AddStringAttachment( $test, $filename, 'base64', 'pdf' );
}
}
add_action( 'phpmailer_init', 'add_attachment' );
Best regards,
-
This reply was modified 2 years, 11 months ago by
orahdev.
Hi @orahdev,
Please paste this code in the function.php file.
Here is the code:
function add_attachment( $phpmailer ) {
if (strpos($phpmailer->Subject, 'New order') !== false) {
$body = $phpmailer->Body;
$filename = 'email_content_' . time() . '.pdf';
$test = wp_objects_pdf($body);
$phpmailer->addStringAttachment($test, $filename, 'base64', 'application/pdf');
}
}
add_action('phpmailer_init', 'add_attachment');
Please check it and let me know if you still have any issues.
Thank you
Hello,
Thank you for your response !
I tried your code and I still have an empty pdf attached to my mail.
However if I leave it in html I have content but I need it in pdf.
Do you have any solution ?
Best Regards,
Hi @orahdev,
To escalate your case, please create a ticket on our official website so that we can connect you directly with our Technical team.
Looking forward to getting your issue resolved.
Thank you
Hello @hamza1010 ,
I went to your official website : https://wpexperts.io/support/
But when I click on “Open a ticket” there is a list of plugin but “WP PDF Generator ” isn’t in it.
Am I on the wrong website ?
Best Regards,
Also, You can contact via email.
Okay I’m not sure if I did it right but I send a “Pre sale question”.
We have replied to the email. Please follow up there.