[Catalyst] Opening existing PDF with Catalyst::View::PDF::API2

Adam Witney awitney at sgul.ac.uk
Sun Oct 12 13:27:10 GMT 2014


Hi, thanks for your reply

> I haven't used it, but looking at the last paragraph of the docs for ``process`` https://metacpan.org/pod/Catalyst::View::PDF::API2#process I notice they say to use $c->stash->{pdf_filename} = 'myfile.pdf'; to set the PDF 
> filename. They also mention what filename is assumed by default.

I think this "filename" defines the filename of the downloaded file rather than an input file

> ->open is a class method of PDF::API2, and I think you only get object methods with the object provided by Catalyst::View::PDF::API2

I think that this is the problem, I can in fact get it to work if I change PDF::API2.pm from

184 sub open_scalar {
185     my ($class, $content, %options) = @_;
186
187     my $self = {};
188     bless $self, $class;

To

184 sub open_scalar {
185     my ($class, $content, %options) = @_;
186
187     my $self = {};
188     if ( ref($class) ) {
189         $self = $class;
190     } else {
191         bless $self, $class;
192     }

This is obviously not an ideal fix but I don't understand how C::V::PDF::API2 interacts with PDF::API2, ie where does the TT pdf object come from?
 
Thanks again for your help

Adam


On Sun, 2014-10-12 at 11:56 +0000, Adam Witney wrote:
> Hi,
> 
> I am trying to use Catalyst::View::PDF::API2 to open an existing PDF, 
> modify it and then send it to the user. Looking at the documentation, 
> it says that you can reuse existing PDF's but it doesn't show how to 
> do it. I have tried this in the template
> 
> [% page = pdf.open('my.pdf') %]
> 
> But this gives the error:
> 
> undef error - Attempt to bless into a reference at /opt/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/PDF/API2.pm line 188.
> 
> Has anyone managed to get this to work? Or does anyone know what this error means?
> 
> Thanks for any help
> 
> Adam
> 
> _______________________________________________
> List: Catalyst at 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/



_______________________________________________
List: Catalyst at 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/



More information about the Catalyst mailing list