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

    thank you poj once again for helping me. The goal is to spread the text across multiple pages. And please help me out from this.please

      What is the max number of characters you would ever expect in one line of data ?.
      What is the smallest font you can have ?

      poj

        it depends upon the data from the network devices. but I can tell like if I download it as txt then the line might reach atleast 1100 lines