I 've written a function that creates a pdf from the page using dompdf module. It's working, but i would like it only to happen when a user clicks a button (or an ahref) in a template. Putting $showpdf (name of the public function in the class) in the template causes it ALWAYS to be triggered.
Can somebody shine a light on this?
UPDATE: I fixed it using a formaction. the only thing that doesn't work is the redirectback after the formaction when writing the pdf tofile. If choose to stream the pdf (and have it ready to download) instead of writing it to disk, everything is working as expected.
If i choose the 'tofile' option there are 2 issues. First the redirect that isn't working. The second issue is that every time the pdf is created, the cms creates a record in the files section which are imho completely redundant, because the file itself is being overwritten.
If someone has a better way of achieving this kind of functionality, i would be happy to hear from you!
Thanx
Guy