Forums

Unable to add TCPDF attachment

driv 17 Oct, 2018
Hi,
I have been trying to add the TCPDF file as an attachment to an email.

The pdf is being generated and I can successfully link to it (and download) in the email.

In the email action, I have 'Auto attach file fields' enabled - but I don't actually have any file fields - as nothing is being uploaded.
(Should I have?)

In the attachment settings I have...

{var:tcpdf15.path}


(The name in the black text box of the TCPDF action.)


The output of the debugger shows the path to be ok.
​[blockquote][tcpdf15] => Array
([br] [path] => /var/sites/mysite.co.uk/public_html/common/xxxxx201810171853.pdf[br] [var] => Array[br] ([br] [path] => /var/sites/mysite.co.uk/public_html/common/xxxxx201810171853.pdf[br] )[br][br] )[/blockquote]
Of course, I'm missing something - but I've no idea what.
[br]Any help would be greatly appreciated.

Cheers,
d.
healyhatman 17 Oct, 2018
Answer
1 Likes
As long as the TCPDF action is before the email action that should be fine. And you're right the Auto Attach File Fields section is not applicable to you. What does the debug for the email action say?
driv 18 Oct, 2018

As long as the TCPDF action is before the email action


Haha, it seems obvious (now)....

Thanks mate!
Elita- 11 Mar, 2020
Hi, driv, how did you link the TCPDF file in email for download?
Thank you in advance-
Elita
healyhatman 11 Mar, 2020
If you want a link in your email that downloads a pdf, then you need the link to point to an event that you have set to "standalone" with Auto display view turned OFF that generates the PDF or returns the stored file.
Elita- 11 Mar, 2020
sorry, Kamron, did not get that😟

so, I have got:

1) a TCPDF with Action "Store" that stores PDF with filename: {var:save_data29.rekNr}_{data:Nom}_{data:Prenom}.pdf

and a storage path (server path) that is as follows /var/www/vhosts/domain.com/httpdocs/images/uploads2020/{var:save_data29.rekNr}_{data:Nom}_{data:Prenom}.pdf

2) Created a standalone action for PDF download

with file or directory path (domain path):

domain.com/images/uploads2020/{var:save_data29.rekNr}_{data:Nom}_{data:Prenom}.pdf

3) tried to point to the event in email -

<a href="domain.com/index.php?option=com_chronoforms6&cont=manager&chronoform=form-2020&event=download_pdf" target="_blank" >Lejupielādēt Rēķinu PDF formātā</a>

nada.

Link opens an empty form...

help will be very appreciated🙂

Elita
healyhatman 11 Mar, 2020
Well yes of course you get an empty form, what have you got IN the event? Anything?
Elita- 11 Mar, 2020
Download action
with the path:


domain.com/images/uploads2020/{var:save_data29.rekNr}_{data:Nom}_{data:Prenom}.pdf
healyhatman 11 Mar, 2020
Can't use the save data action var, that's only available when the save data action has actually been used, which it won't have. You will need to read the filename back from the database. You might need to include the id in your URL on the email.
Elita- 11 Mar, 2020
I wonder... is it possible to use data builder for this? On Demo form @Max created with download button after send action he uses Data builder and builds session path.....
There are two other options available - data and var - dont know what would be the right syntax though....

To build session path Max used this:
1) TCPDF action tcpdf3;
2) Data builder -
(Type) Session (Name) pdf_path (Value) {var:tcpdf3.path}
3) download action with ( File or directory path) - {session:pdf_path}

this nicely builds Server path with the right filename needed:
/var/www/vhosts/domain.com/httpdocs/images/uploads2020/INET-2020243_Nom_Prenom.pdf

So I wonder - perhaps it is possible to build a domain path that could be used for a link in email?!



face-meh-blank

Elita
healyhatman 11 Mar, 2020
Session is no good because then the email link will ONLY work on the same computer they did the form on and ONLY for a limited time. You need to use the ID or some other identifier
raffaele.jacovelli 01 Apr, 2020
Hi,

I have somehow a problem associated with the path in TCPDF: the file is created and is attached in the email , but I have 2 issues:
1) the name of the file attached has as a prefix chronoforms_pdf_nameof file, which is quite annoying and I could n't fifure out how to get rid of the prefix.
2) the file actually saved is saved like this : chronoforms\pdf\01-04-20-10-02-06.pdf with back slashes, which obviously prevents it to be deleted as it's not allowed.

in file path I've tried to use {path:front}/pdf/ but if a do this I get an error in tcpdf static while if I use the backslashes I get an empty file name with chronoforms prefix only and without the odf extension. the only way I got it to work is using {path:front}\pdf\{date:d-m-y-h-i-s}.pdf with the back slashes, but is strange to have the actual file name in the path.

can you help here?

Thanks
Raffaele
healyhatman 01 Apr, 2020
After you create and store the PDF, if you have a look at the debug data the {var:pdf_action_name} should include things like the filename
This topic is locked and no more replies can be posted.