El 03/03/11 23:26, Victor Churchill escribió:
On 3 March 2011 21:49, Wes Cravens<wcrav...@cortex-it.com> wrote:
I fell into exactly this same hole earlier today in fact. I'm not exactly
sure why this is set in the stash rather than the template, or why the
template setting seems to be ignored (or something). I've not had the time
to investigate further... but from the docs...
$ perldoc Catalyst::View::PDF::Reuse
<snip>
The filename and content disposition (inline or attachment) can be
controlled by putting the following values in the stash:
$c->stash->{pdf_disposition} = 'attachment'; # Default is 'inline'
$c->stash->{pdf_filename} = 'myfile.pdf';
</snip>
Yes, I have not investigated {pdf_disposition} but {pdf_filename}
DEWISOTT (and you do need it, otherwise you get an error). Regarding
an initial pdf.prFile, it seems that if you use that in your template
then it closes a file prevoiusly 'opened' by CVPR and whatever you put
in thereafter is lost.
You don't *need* the "pdf_filename" in the stash, and this PDF filename
has nothing to do with the PDF file you want to generate. Of course,
Catalyst probably does a prFile (wioth a temporary filename) *before*
handing control to the template, and it expects that when your template
finishes the PDF info is in the file it specified.
If you do another prFile, the Catalyst one gests closed, and you get
nothing, as you are writing somewhere else which Catalyst knows nothing
about.
With "pdf_filename" in the stash you specify the filename that will be
sent *to the browser* as the preferred name for the attachment, instead
of letting the browser generate one automatically. What error do you get
if you don't specify it?
The PDF on the server is spit out on stdout, following the normal
Catalyst information flow (and sent to the browser).
OTH, specifying the output filename with prFile, when you are using the
module from a web application framework seems a bad idea to me. Input
and output are being hanlded somewhere else... (i.e. Catalyst). Nowhere
in the docs of CVPR states that you have to use prFile to generate the PDF.
prFile must be used when you are using PDF::Reuse on a standalone
script, as a mean of getting the generated PDF on disk. But with CVPR,
the PDF gets output directly to stdout (Catalyst handles that!). You
just have to design your PDF, Catalys does everything else for you.
Regards
J.
_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/