[Bioperl-l] problem in PDF::Create module

Shachi Gahoi shachigahoimbi at gmail.com
Wed Jun 8 10:07:00 UTC 2011


Thanks, It works

On Wed, Jun 8, 2011 at 3:01 PM, Dave Howorth <dhoworth at mrc-lmb.cam.ac.uk>wrote:

> Shachi Gahoi wrote:
> > Dear All,
> >
> > I am using PDF::Create module of bioperl to insert image in pdf file,
> >
> > Here is the script on which I am working
> >
> > ######################################################################
> >
> > #!/usr/bin/perl
> >
> > use PDF;
> > use PDF::Create;
> >
> > my $pdf = new PDF::Create('filename' => 'image.pdf');
> >
> > my $a4 = $pdf->new_page('MediaBox' => $pdf->get_page_size('A4'));
> >
> > my $page = $a4->new_page;
> >
> > $page->image('domain.jpeg');
> >
> > $pdf->close;
> >
> >
> #############################################################################
> >
> > In this script I am trying to insert domain.jpeg image in new pdf file
> > image.pdf. But when I am running the script, It is giving one error---
> >
> > Error-
> >
> #############################################################################
> > *Can't use string ("1.2") as a HASH ref while "strict refs" in use at
> > /usr/local/share/perl/5.10.1/PDF/Create/Page.pm line 474.
> > *
> >
> #############################################################################
> >
> > I am new to this module (PDF::Create). Is there any error in my script.
> > Please help me.
>
> I'm new to it too. It seems PDF::Create is not very well documented :(
>
> Here's some code that works:
>
> #!/usr/bin/perl
> use strict;
> use warnings;
>
> #use PDF;
> use PDF::Create;
>
> my $pdf = new PDF::Create('filename' => 'image.pdf');
>
> my $a4 = $pdf->new_page('MediaBox' => $pdf->get_page_size('A4'));
>
> my $page = $a4->new_page;
>
> my $image = $pdf->image('domain.jpeg');
>
> #$page->image($image, 10, 10);
> $page->image(image => $image, xpos => 10, ypos => 10);
>
> $pdf->close;
>
> Hints:
> (1) always use strict; use warnings;
> (2) there's no need to use PDF
> (3) the image method you called should be invoked by the document, not
> the page. That's documented, though not very clearly.
> (4) you then need to invoke the page's image method. It is described
> later in the POD, but the description of the arguments is plain wrong.
> (Read its code to find out what the real arguments are!)
> (5) general perl questions like this are probably better asked at
> perlmonks rather than here
>
> HTH, Dave
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>



-- 
Regards,
Shachi



More information about the Bioperl-l mailing list