Forums

Action TCPDF : attach file to email with customize file name

M.Abletech 18 Aug, 2018
Hi,

as read on this faq : https://www.chronoengine.com/faqs/61-cfv4/cfv4-tutorials/4133-how-can-i-create-a-pdf-including-form-results.html

1) I've put a custom code before tcpdf action with this code:
<?php
$form->data['pdf_file_name'] = 'Preventivo_IX_per'.'_'.$form->data['name'].'_'.date("Y-m-d_h:i:s");
?>

2) I've set the tcpdf action:



3) I've created put a custom code after tcpdf action with this code:
<?php
$form->data['pdf_link'] = "<a href='{$form->files['cf_pdf_file']['link']}' >Click here</a>";
?>
ERROR: The problem is that the debugger show the field pdf_link empty:



Any advice?

Thanks!
M.Abletech 27 Aug, 2018
Sorry I thought I solved it but I didn't.

I'll make a new post.
M.Abletech 27 Aug, 2018
https://www.chronoengine.com/forums/posts/t106016/action-tcpdf-attach-file-to-email-with-customize-file-name
GreyHead 29 Aug, 2018
Hi M.Abletech,

Do you have your Email action after the TCPDF action?

If you add a Debugger action after your Custom Code action you should be able to see if the link is being created correctly.

In the examples I saw in your first post here the Debugger data shows that the files data is wrong - the value of the link is the same as that for the path. That's a CF bug that I thought had been fixed, if not you can add to your custom code to change the value to the correct url for the file.

Bob
M.Abletech 30 Aug, 2018
thank you!

So you mean I need to update [preventivo][link] with a custom action between tcpdf action and mail action?
And changing the value from the relative path to the url?

Thanks
GreyHead 31 Aug, 2018
Hi M.Abletech,

There's an example in this post of customising the TCPDF data. The bug is corrected in the last couple of lines.

Bob
This topic is locked and no more replies can be posted.