Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6625425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:46:25+00:00 2026-05-25T21:46:25+00:00

All the PDF libraries for Perl seem a bit barbaric — stuck in the

  • 0

All the PDF libraries for Perl seem a bit barbaric — stuck in the 1980’s. You have to specify PostScript points to do layout. Java has JasperReports, Ruby has Prawn, and Python has ReportLab. Is there a non-extinct library/module that will let me make a nice looking PDF in less than a week of coding? (I’m a little frustrated by PDF::API2, PDF::Table, etc.) I don’t want to generate HTML and convert it. Perl is ideal for reporting, but the main report file format is not available in a usable way. What libraries do people use?

I need:

  • tables
  • charts (Images)
  • color
  • formatting (ideally automatic, not pixel by pixel)
  • headers / footers

I’m slightly open to wrapping external (non-Perl) open source tools, if absolutely needed. But not really interested in a major Java server approach. For the bounty, I want a pure Perl approach, since I want to run this on a server that I can’t add more than modules to. If you have a public example that works well, please point me to it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:46:26+00:00Added an answer on May 25, 2026 at 9:46 pm

    If LaTeX is too big, perhaps one could use Inline::Python to wrap ReportLab, that everyone seems to like so much (I haven’t used it and am not too proficient at Python).

    Edit 3:
    Here is Edit 2, except split into a modular style, if people like it (and if it is an kind of robust) perhaps I can publish to CPAN. For now place the .pm file in a file structure like Inline/Python/ReportLab.pm somewhere in your @INC (the script’s own base directory is usually in @INC).

    # Inline/Python/ReportLab.pm
    package Inline::Python::ReportLab;
    
    use strict;
    use warnings;
    
    use Carp;
    
    use Inline::Python qw/py_eval/;
    our @ISA = 'Inline::Python::Object';
    
    sub import {
      py_eval('from reportlab.pdfgen.canvas import Canvas');
    }
    
    sub new {
      my $class = shift;
      my $filename = shift || croak "Must specify file name to contructor";
      return bless(Inline::Python::Object->new('__main__', 'Canvas', $filename), $class);
    }
    
    1;
    

    Then a script could be something like:

    #!/usr/bin/env perl
    
    use strict;
    use warnings;
    
    use Inline::Python::ReportLab;
    
    my $c = Inline::Python::ReportLab->new('hello.pdf');
    $c->drawString(100,100,"Hello World");
    $c->showPage();
    $c->save();
    

    Edit 2:
    While Edit 1 is still of interest, it seems (tell me if I am incorrect!) that I have figured out how to create an instance of ‘Canvas’ and expose its methods directly:

    #!/usr/bin/env perl
    
    use strict;
    use warnings;
    
    use Inline::Python qw/py_eval/;
    
    py_eval('from reportlab.pdfgen.canvas import Canvas');
    
    my $c = Inline::Python::Object->new('__main__', 'Canvas', 'hello.pdf');
    $c->drawString(100,100,"Hello World");
    $c->showPage();
    $c->save();
    

    Edit 2/3: This portion is left as an example of a more manual interface. I think Edits 2/3 give a better interface which leaves the heavy lifting to the original Python class without (too much) wrapping.

    Edit 1: I have now exposed some of the functionality by manually hacking in the methods. This means that for every method one wants to use, a wrapper method must be added. While this is already a feasible solution, I wonder if there isn’t some easier way to expose the entire python ‘canvas’ class, but for now this is where I am:

    #!/usr/bin/env perl
    
    use strict;
    use warnings;
    
    use Inline Python => <<END_PYTHON;
    from reportlab.pdfgen import canvas
    
    class Canvas:
      def __init__(self,filename):
        self.canvas = canvas.Canvas(filename)
      def drawString(self,x,y,text):
        self.canvas.drawString(x,y,text)
      def save(self):
        self.canvas.showPage()
        self.canvas.save()
    
    END_PYTHON
    
    my $c = Canvas->new('hello.pdf');
    $c->drawString(100,100,"Hello World");
    $c->save();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a row of buttons, which all create a pdf file which I
I have a pdf file.I need to find all the hyperlinks available in that
I have a PDF document that has several hundred fields. All of the field
Hi i'm wondering how to redirect a http://mysite.com/pdf/blah.pdf to http://mysite.com/pages/page.aspx for all pdf file
I need to extract all the images from a PDF file on my server.
In Eclipse, I often include all project-related material (including documents in PDF, Microsoft, and
Following this example, I can list all elements into a pdf file import pyPdf
I have a pdf which contains 'UniCNS-UCS2-H' font, I tried both pdfbox and pdfrenderer,
I have downloaded Qt SDK (with the libraries) for Linux from the Qt website.
I have a WSGI application that generates invoices and stores them as PDF. So

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.