Active
Project:
Pdfview
Version:
master
Component:
User interface
Priority:
Minor
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
23 Feb 2007 at 20:06 UTC
Updated:
1 Mar 2007 at 13:29 UTC
I would like to be able to generate a pdf using $pdf completely from scratch within my own custom module.
I actually managed to do this by getting (hacking) my version of pdfview.module to call a hook_pdfview if one was defined, passing the $pdf as a parameter, then my modules hook_pdfview could render the pdf and return it.
I could not think of another way to do it, is a feature like this planned for a future version of pdfview?
Comments
Comment #1
Egon Bianchet commentedI'm open to that, but I don't have a clear idea about how to deal with hooks, the themeable fuctions available today, and other proposals such as extending the tcpdf class ... would it be better to let other modules manipulate the pdf object or have a pdfview api?
Comment #2
the greenman commentedAlthough I am normally an obsessive API man, in this case, I think that you have a pretty good API in the tcpdf code. Rather than adding your own layer, I would suggest that you pass the $pdf object directly.
One note though, you cannot pass references to hooks, it is one of the PHP limitations. So, for really big PDF files, there may be a memory issue, however, I think you can burn that bridge when you get to it.
Comment #3
the greenman commentedOh, and one more detail.
The usual "module_invoke_all" will pass your initial pdf object to any implemented hooks. This may not actually be the best in this situation because you may, in theory, have more than one external module effecting the object. You may want to go a step lower, and pass the output of one hook to the input of the next hook.
Module_invoke_all is not very complex, so it is less daunting than it sounds.