Pdf send in list

coullet

Member
Hi,

i need to add a function in a list to send a pdf , the same i can get with the pdf from button.

I can use a php plugin, create a dompdf object with the row data and send the result.

But instead of re-create all the html code, is it possible to use the form pdf template to do that?

Thanks
 
The download plugin has an option to download PDF's of the details view for each selected row.

Two issues:

1) It ZIP's them up, as you can only download one file (that's an HTML thing, not a Fabrik thing), and it's not possible (or at least, I haven't been able to do it) to concatenate PDF files in PHP. There's a paid extension to TCPDF that does it, which I've experimented with, but nothing I know of that works without that, and the entire TCPDF library being loaded. I could probably change this a little, so if only one row is selected, it doesn't ZIP the file.

2) It builds the PDF through a quick and dirty method of doing a file_get_contents() on the detail view link to the site. Which works OK, except that there's no authentication, so if your list has access controls on it, it won't work.

Other than that, you could look at the code in the pdfAttachment() method in the form email plugin, which creates the detail view PDF "long hand", in ./plugins/fabrik_form/email/email.php, starting around line 420. But as you can see, it's kind of a nasty hack. the problem being, form/detail templates are rendered as views, in the "Model, View, Controller" methodology that J! uses. Which assumes that there's going to be one controller, one model, and one view. Once you are already in a model/controller, trying to then fire off another controller/view is a major pain.

-- hugh
 
Sorry, i haven't be enough specific, i want to send the pdf by mail, not download it.

Anyway, i have a look at download plugin, and i use the same method to get a pdf file

Code:
$url  = COM_FABRIK_LIVESITE . 'index.php?option=com_fabrik&view=details&formid=' . $formId . '&rowid=' . $rowId . '&format=pdf' ;
$pdfContent = file_get_contents($url);
JFile::write($p, $pdfContent);

and send it with joomla mail function, work fine

As you say, i need to have list record access to public. (other access setting is registred)
Data is not critical, so i can leave with that.

But for best understand access control, can you tell me about the risk to set it like that?
-whole site have a restricted access
-menu item have also restricted access
- list access is set to registered

Thanks!
 
-whole site have a restricted access
How? htaccess or just showing only Joomla login to the user?
If you can see the site you can display the single records by typing the URL directly (and guessing a rowid).
You could add an additional param e.g. &secret=asdjfhlljl and use a list prefilter looking for this param.
 
Protected with joomla login

All list is set with registered access or higher.
So, it's good for me, it's a little team, people have others thing to do as to trying URL, and there is no secret thing...

Thanks
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top