NAME
Mxpress::PDF - PDF
VERSION
Version 0.04
SYNOPSIS
use Mxpress::PDF;
my @data = qw/
Brian
Dougal
Dylan
Ermintrude
Florence
Zebedee
/;
my $gen_text = sub { join( ' ', map { $data[int(rand(scalar @data))] } 0 .. int(rand(shift))) };
my $pdf = Mxpress::PDF->new_pdf('test',
page => {
background => '#000',
padding => 15,
},
toc => {
font => { colour => '#00f' },
},
title => {
font => {
colour => '#f00',
},
margin_bottom => 3,
},
subtitle => {
font => {
colour => '#0ff',
},
margin_bottom => 3
},
subsubtitle => {
font => {
colour => '#f0f',
},
margin_bottom => 3
},
text => {
font => { align => 'justify', colour => '#fff' },
margin_bottom => 3
},
)->add_page->title->add(
$gen_text->(5)
)->toc->placeholder;
$pdf->page->columns(2);
for (0 .. 100) {
$pdf->toc->add(
[qw/title subtitle subsubtitle/]->[int(rand(3))] => $gen_text->(4)
)->text->add( $gen_text->(1000) );
}
Factory
Start a new pdf.
my $file = Mxpress->new_pdf(
page => {},
toc => {},
title => {},
subtitle => {},
subsubtitle => {},
text => {},
toc => {},
box => {},
line => {},
circle => {},
pie => {},
ellipse => {}
)
Mxpress::Page->page(%page_args);
...
File
Attributes
$file->$attr
file_name (type => Str, required => 1);
pdf (required => 1, type => Object);
pages (required => 1, type => ArrayRef);
page (type => Object);
page_args (type => HashRef);
onsave_cbs (type => ArrayRef);
Plugins
$file->$plugin->$thing()
font
line
box
circle
pie
toc
title
subtitle
subsubtitle
text
toc
box
line
circle
pie
ellipse
Methods
add_page
$file->add_page(%page_attrs)
save
$file->save();
onsave
$file->onsave($plugin, $cb, \%plugin_args)
Page
my $page = $file->page;
Attributes
$page->$attr
page_size (type => Str);
background (type => Str);
num (type => Num, required => 1);
current (type => Object);
columns (type => Num);
column (type => Num);
rows (type => Num);
row (type => Num);
row_y (type => Num);
is_rotated (type => Num);
x (type => Num);
y (type => Num);
w (type => Num);
h (type => Num);
full (type => Bool);
padding (type => Num);
margin_top (type => Num);
margin_bottom (type => Num);
Methods
rotate
$page->rotate();
next_column
$page->next_column();
next_row
$page->next_row();
Font
my $font = $file->font;
Attributes
$font->$attr();
colour (type => Str);
size (type => Num);
family (type => Str);
loaded (type => HashRef);
line_height ( type => Num);
Methods
load
$font->load()
find
$font->find($famild, $enc?)
Line
my $line = $file->line;
Attributes
$line->$attr();
fill_colour (type => Str);
position (type => ArrayRef);
end_position (type => ArrayRef);
Methods
add
$line->add(%line_args);
shape
$line->shape($shape);
Box
my $box = $file->box;
Attributes
$box->$attr();
fill_colour (type => Str);
position (type => ArrayRef);
Methods
add
$box->add(%line_args);
shape
$box->shape($shape);
Circle
my $circle = $file->circle;
Attributes
$circle->$attr();
fill_colour (type => Str);
radius (type => Num);
position (type => ArrayRef);
Methods
add
$circle->add(%line_args);
shape
$circle->shape($shape);
Pie
my $pie = $file->pie;
Attributes
$pie->$attr();
fill_colour (type => Str);
radius (type => Num);
start (type => Num);
end (type => Num);
position (type => ArrayRef);
Methods
add
$pie->add(%pie_attrs);
shape
$pie->shape($shape);
Ellipse
my $ellipse = $file->ellipse;
Attributes
$ellipse->$attr();
Attributes
fill_colour (type => Str);
radius (type => Num);
start (type => Num);
end (type => Num);
position (type => ArrayRef);
Methods
add
$ellipse->add(%ellipse_attrs);
shape
$ellipse->shape($shape);
Text
my $text = $file->text;
Attributes
$text->$attrs();
font (type => Object);
paragraph_space (type => Num);
paragraphs_to_columns (type => Bool);
first_line_indent (type => Num);
first_paragraph_indent (type => Num);
align (type => Str); #enum
margin_bottom (type => Num);
indent (type => Num);
pad (type => Str);
pad_end (type => Str);
next_page;
Methods
add
$text->add($string_of_text, %text_args);
Title
my $title = $file->title;
Attributes
$title->$attrs();
font (type => Object);
paragraph_space (type => Num);
paragraphs_to_columns (type => Bool);
first_line_indent (type => Num);
first_paragraph_indent (type => Num);
align (type => Str); #enum
margin_bottom (type => Num);
indent (type => Num);
pad (type => Str);
pad_end (type => Str);
next_page;
Methods
add
$title->add($string_of_text, %text_args);
Subtitle
my $st = $file->subtitle;
Attributes
$st->$attrs();
font (type => Object);
paragraph_space (type => Num);
paragraphs_to_columns (type => Bool);
first_line_indent (type => Num);
first_paragraph_indent (type => Num);
align (type => Str); #enum
margin_bottom (type => Num);
indent (type => Num);
pad (type => Str);
pad_end (type => Str);
next_page;
Methods
add
$st->add($string_of_text, %text_args);
Subsubtitle
my $sst = $file->subsubtitle;
Attributes
$sst->$attrs();
font (type => Object);
paragraph_space (type => Num);
paragraphs_to_columns (type => Bool);
first_line_indent (type => Num);
first_paragraph_indent (type => Num);
align (type => Str); #enum
margin_bottom (type => Num);
indent (type => Num);
pad (type => Str);
pad_end (type => Str);
next_page;
Methods
add
$sst->add($string_of_text, %text_args);
TOC
my $toc = $file->toc;
Attributes
count (type => Num);
toc_placeholder (type => HashRef);
outline (type => Object);
outlines (type => ArrayRef);
indent (type => Num);
levels (type => ArrayRef);
toc_line_offset (type => Num);
font (type => HashRef);
Methods
placeholder
The placeholder position where the table of contents will be rendered.
$toc->placeholder(%placeholder_attrs);
add
Add to the table of contents
$toc->add(%placeholders_attrs)
TOC Outline
my $outline = $file->FACTORY->add_outline()
Attributes
$outline->$attrs();
outline (type => Object);
x (type => Num);
y (type => Num);
title (type => Str);
page (type => Object);
level (type => Num);
children (type => ArrayRef);
Methods
render
$outline->render(%outline_attrs)
Image
my $img = $file->image;
Attributes
$img->$attrs();
width (type => Num);
height (type => Num);
align (type => Str);
valid_mime (type => HashRef);
Methods
add
$img->add($image_fh, $type, %image_attrs)
or
$img->add($image_file_path, %image_attrs)
Factory
Note
experimental.
AUTHOR
LNATION, <thisusedtobeanemail at gmail.com>
BUGS
Please report any bugs or feature requests to bug-mxpress-pdf at rt.cpan.org
, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Mxpress-PDF. 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 Mxpress::PDF
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
LICENSE AND COPYRIGHT
This software is Copyright (c) 2020 by LNATION.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
2 POD Errors
The following errors were encountered while parsing the POD:
- Around line 827:
Unknown directive: =new
- Around line 848:
Unknown directive: =head