我有一个(‘RenderView’)方法,它使用PDF::API2 2在飞行中创建一个PDF。
我不想保存PDF,相反,我想强制下载对话框。类似于这个伪代码:
... create pdf on-the-fly ...
$pdf->saveas($fullPathToFilename); # is there a way to avoid this?
binmode STDOUT;
$c->res->content_type('application/pdf');
$c->res->header( 'Content-Disposition', qq[attachment;filename='$shortFilename'] );
$c->res->header( 'someOtherHeaders' );
... here, stream binary content to client ?? ...
return $self->status_ok( $c, entity => 'PDF' );我想我可以反复测试所创建的文件是否存在,并在保存和发现文件时提供服务。对我来说,这似乎是很有道理的。
有人有更好的解决方案吗?
谢谢,诺亚
发布于 2014-10-02 19:05:26
https://stackoverflow.com/questions/26167279
复制相似问题