File: row_height.pl

package info (click to toggle)
libpdf-table-perl 1%3A0.10.1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 216 kB
  • sloc: perl: 999; makefile: 2
file content (45 lines) | stat: -rwxr-xr-x 770 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env perl
use warnings;
use strict;
use diagnostics;

use PDF::API2;
use PDF::Table;

my $pdftable = PDF::Table->new();
my $pdf      = PDF::API2->new( -file => "row_height.pdf" );
my $page     = $pdf->page();
$pdf->mediabox('A4');

# A4 as defined by PDF::API2 is h=842 w=545 for portrait

my $data = [];

# some data to layout

foreach my $num ( 1 .. 25 ) {
	push( @$data, [ 'foo' . $num, 'bar' . $num ] );
}

# build the table layout
$pdftable->table(

	# required params
	$pdf,
	$page,
	$data,
	x       => 10,
	w       => 150,
	start_y => 750,
	next_y  => 700,
	start_h => 200,
	next_h  => 500,

	# some optional params
	border          => 1,
	font_size       => 10,
	max_word_length => 15,
	padding         => 5,
	row_height      => 30,
);
$pdf->saveas();