Dear Monks,

I am using API2 package (to generate PDF report) for the first time and trying to test it via simple Hello World Code. The moment I try to write something to the pdf file, I get errors from Content.pm. If i simply create new file and save it, it does create blank pdf file. I am working in Linux environment.If there is another way to generate pdf report, please let me know.

This is my code:
use PDF::API2; use PDF::API2::Util; my $pdf = PDF::API2->new(); my $font = $pdf->corefont('Times-Roman'); my $page = $pdf->page; $page->mediabox(595,842); my $gfx=$page->gfx; $gfx->textlabel(50,780,$font,20,"Hello World! (3)"); #my $headline_text = $page->text; #$headline_text->text("Hello World"); $pdf->saveas("/tmp/HelloWorld.pdf"); $pdf->end();
and got this error:
error: Undefined subroutine &Compress::Zlib::compress called at /usr/l +ib/perl5/site_perl/5.8.0/PDF/API2/Content.pm line 102. context: ... 98: delete($self->{" $k"}); 99: } 100: if($self->{-docompress}==1 && $self->{Filter}) 101: { 102: $self->{' stream'}=Compress::Zlib::compress($self->{' stream'}); 103: $self->{' nofilt'}=1; 104: delete $self->{-docompress}; 105: } 106: $self->SUPER::outobjdeep(@_); ... code stack: /usr/lib/perl5/site_perl/5.8.0/PDF/API2/Content.pm:102 /usr/lib/perl5/site_perl/5.8.0/PDF/API2/Basic/PDF/File.pm:953 /usr/lib/perl5/site_perl/5.8.0/PDF/API2/Basic/PDF/File.pm:1255 /usr/lib/perl5/site_perl/5.8.0/PDF/API2/Basic/PDF/File.pm:500 /usr/lib/perl5/site_perl/5.8.0/PDF/API2/Basic/PDF/File.pm:436 /usr/lib/perl5/site_perl/5.8.0/PDF/API2.pm:893 /usr/local/apache/html/bioinfo/pfc/view/view_dige.mhtml:52 /usr/local/apache/html/bioinfo/pfc/view/autohandler:107 /usr/local/apache/html/bioinfo/pfc/view/syshandler:42

In reply to Errors while generating PDF report by nargis

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.