NAME
Khonsu - PDF Generation!
VERSION
Version 0.08
SYNOPSIS
my @words = ('Aker', 'Anubis', 'Hapi', 'Khepri', 'Maahes', 'Thoth', 'Bastet', 'Hatmehit', 'Tefnut', 'Menhit', 'Imentet');
my $generate_text = sub {
my $length = shift;
return join " ", map { $words[int(rand(scalar @words))] } 1 .. $length;
};
use Khonsu;
my $padding = 20;
my $page_padding = $padding * 2;
my $khonsu = Khonsu->new(
'Ra',
page_size => 'A4',
page_args => {
background => '#3ff'
},
configure => {
page_header => {
padding => $padding,
show_page_num => 'right',
page_num_text => 'page {num}',
h => $padding,
cb => sub {
my ($self, $file, %atts) = @_;
$self->add(
$file,
text => 'Ra',
align => 'center',
%attrs,
);
}
},
page_footer => {
padding => $padding,
show_page_num => 'left',
page_num_text => 'page {num}',
h => $padding,
cb => sub {
my ($self, $file, %atts) = @_;
$self->add(
$file,
text => 'Ra',
align => 'center',
%attrs,
);
}
},
toc => {
title => 'Table of contents',
title_font_args => {
size => 50,
},
title_padding => 10,
font_args => {
size => 20,
},
padding => 5,
},
h1 => {
font => { colour => '#0EE' }
}
}
);
$khonsu->add_image(
image => 't/test.png',
x => $padding,
y => $padding,
w => $khonsu->page->w - $page_padding,
h => $khonsu->page->h - $page_padding,
)->add_page;
$khonsu->add_toc();
$khonsu->set_columns(2);
for (0 .. 100) {
$khonsu->add_h1(
text => $generate_text->(3),
toc => 1,
)->add_text(
text => $generate_text->(2000),
indent => 4,
font => {
colour => '#fff'
},
);
}
$khonsu->set_columns(1);
$khonsu->add_h1(
text => 'A simple form',
toc => 1
);
$khonsu->add_input(
text => 'Name:'
);
$khonsu->add_select(
text => 'Colour:',
options => [qw/red yellow green/]
);
$khonsu->save();
METHODS
add_page
set_columns
open_page
add_page_header
add_page_footer
remove_page_header_and_footer
remove_page_header
remove_page_footer
add_toc
add_text
add_h1
add_h2
add_h3
add_h4
add_h5
add_h6
add_image
add_form
add_input
add_select
add_line
add_box
add_circle
add_pie
add_ellipse
load_font
AUTHOR
LNATION, <email at lnation.org>
BUGS
Please report any bugs or feature requests to bug-khonsu at rt.cpan.org
, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Khonsu. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Khonsu
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
LICENSE AND COPYRIGHT
This software is Copyright (c) 2023 by LNATION.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)