in reply to Re^2: download an array of text as pdf
in thread download an array of text as pdf
Reduce the font size, rotate the page to landscape or try this.
#!perl use strict; use warnings; use PDF::API2; my $save_pdf_as = "mypdf.pdf"; my $pdf = PDF::API2->new(); my $page = $pdf->page() ->mediabox('Letter'); my $font = $pdf->corefont('Helvetica-Bold'); my $text = $page->text() ->font($font, 20); $text->lead(25); $text->translate(100, 700); while (<DATA>){ $text->paragraph($_, 400, 400, -align => "left" ); # width height $text->cr(-5); } $pdf->saveas($save_pdf_as); __DATA__ line 1 is a very long line that extends past the end of the page line 2 is also very long line that extends past the end of the page line 3 line 4
The height of the paragraph box needs to be large enough for the text
If you need to spread the text across multiple pages then it can get complicated !
poj
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: download an array of text as pdf
by ajaykannan (Novice) on Dec 07, 2016 at 14:38 UTC | |
by poj (Abbot) on Dec 07, 2016 at 17:02 UTC | |
by ajaykannan (Novice) on Dec 07, 2016 at 22:58 UTC | |
by poj (Abbot) on Dec 08, 2016 at 08:06 UTC |