in reply to Re: Write To PDF File
in thread Write To PDF File

Thanks FrozenWithJoy for your reply...

I did look at that module and it seems to require you to save the report into a text file first, then read that text file and write to a pdf.

Just wondering if there's a direct way to print to a pdf file.

Replies are listed 'Best First'.
Re^3: Write To PDF File
by frozenwithjoy (Priest) on Jun 28, 2012 at 20:50 UTC

    I wrote a quick script based on the documentation from PDF::API2 and it works fine without using an intermediate file:

    #!/usr/bin/env perl use strict; use warnings; use PDF::API2; # Create a blank PDF file my $pdf = PDF::API2->new(); # Add a blank page my $page = $pdf->page(); # Set the page size $page->mediabox('Letter'); # Add a built-in font to the PDF my $font = $pdf->corefont('Helvetica-Bold'); # Add some text to the page my $text = $page->text(); $text->font($font, 20); $text->translate(200, 700); $text->text('Hello World!'); # Save the PDF $pdf->saveas('new.pdf');
    A reply falls below the community's threshold of quality. You may see it by logging in.
    A reply falls below the community's threshold of quality. You may see it by logging in.