Hi, I want to download a PDF file that was generated in CF6 using TCPDF. As such CF6 Entry creates a different named PDF for each submitter.
Now I want to create a link to download that PDF specific to that user on their single record detail page in CC6.
I tried using the same code as downloading an Uploaded File from a CF6 form, but no luck.
Any suggestions? Thanks
It depends on what sort of controls you want to put in place, for example to make it so people would need a special code to download the file or if you want it so anyone with the right name can download the file, or if there's only one file per logged-in-user, in which case you should name the file with their user id instead of their name.
Let's pretend you're calling it {user:id}.pdf
Create a "download" event in your form.
In the event, have a "download" action. File path is path/to/file/{user:id}.pdf OR you could store the filename in a database when the user creates it and use {var:read_data#.model.pdf_path}
For the link
if you're generating the link in the same form you can use <a href = "{url/full:download}">Download file here</a>
If you're generating the link on a different page or a different form use <a href="https://yoursite.com/index.php?option=com_chronoforms6&chronoform=formname&event=download">Download file here</a>
You could also save the file name and a {uuid:} code to the database, and the link to the file would be "{url:download}&code={var:blocknamewhereyougeneratethecode}" then use {data:code} in the download event to check the database and if the code is found, download the file.
Hi,
Really appreciate your options.
I would just make a menu link to the report as restricted access. Nothing special. I want dept heads only to access these PDF files whenever they need as some may not get the initial email attachment sent to them for every applicant.
The challenge is I won't know the file name as it is set up under TCPDF to name the file based on the persons first/last name.
so for example my CF6 form, once completed and it automatically generates a PDF file named which gets sent as an email attachment to the applicant and maybe another dept head.
eg. file name generated once application is completed: "date_firstname_lastname.pdf"
The file will always be different for each applicant, so my struggle is how to call the file name that is always changing [all files saved in /components/com_chronoforms6/chronoforms/pdf/ ]
I'm trying to understand your instructions, but not doing to well figuring this out.
So I created Create HTML view:
Content:
<p><a href="/components/com_chronoforms6/chronoforms/pdf/{user:id}">Download Completed Application</a></p>
I get a 403. I'm sure my code is not right?
My confusion is since there is no field name attached to the generated TCPDF file I don't know how to retrieve either by Functions or Views Event.
Your code is definitely not right and you might need to try reading what I wrote again. After the TCPDF action, the full path of the new file is available with {var:tcpdf#.path} if you want to save that to a database to read from later. But again if the files are generated only by logged in users then you should use the user id for the filename instead of a first and last name.
Is this "report" you're talking about a CC connection?
Hi, I want to download a PDF file in CC6 that was generated in CF6 using TCPDF.
As such CF6 Entry creates a different named PDF for each submitter. Now I want to create a link to download that PDF specific to that user on their single record detail page in CC6. This PDF is saved on the server as stated at /components/com_chronoforms6/chronoforms/pdf/
I read thorougly your instructions and since I'm not a programmer it's hard to understand all the jargon.
Thank you. I'll try to work through this.. Again thanks for all you do.