r20367 - in /trunk/libpdf-create-perl: CHANGES META.yml TODO debian/changelog lib/PDF/Create.pm lib/PDF/Create/Page.pm sample.pl t/1-simple.t t/2-jpeg.t t/3-gif.t t/4-graphics.t t/5-complex.t t/minimal.t t/pdf-logo.gif t/pdf-logo.jpg
gregoa at users.alioth.debian.org
gregoa at users.alioth.debian.org
Fri May 23 20:00:57 UTC 2008
Author: gregoa
Date: Fri May 23 20:00:57 2008
New Revision: 20367
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=20367
Log:
New upstream release.
Added:
trunk/libpdf-create-perl/TODO
- copied unchanged from r20366, branches/upstream/libpdf-create-perl/current/TODO
trunk/libpdf-create-perl/t/1-simple.t
- copied unchanged from r20366, branches/upstream/libpdf-create-perl/current/t/1-simple.t
trunk/libpdf-create-perl/t/2-jpeg.t
- copied unchanged from r20366, branches/upstream/libpdf-create-perl/current/t/2-jpeg.t
trunk/libpdf-create-perl/t/3-gif.t
- copied unchanged from r20366, branches/upstream/libpdf-create-perl/current/t/3-gif.t
trunk/libpdf-create-perl/t/4-graphics.t
- copied unchanged from r20366, branches/upstream/libpdf-create-perl/current/t/4-graphics.t
trunk/libpdf-create-perl/t/5-complex.t
- copied unchanged from r20366, branches/upstream/libpdf-create-perl/current/t/5-complex.t
trunk/libpdf-create-perl/t/pdf-logo.gif
- copied unchanged from r20366, branches/upstream/libpdf-create-perl/current/t/pdf-logo.gif
trunk/libpdf-create-perl/t/pdf-logo.jpg
- copied unchanged from r20366, branches/upstream/libpdf-create-perl/current/t/pdf-logo.jpg
Removed:
trunk/libpdf-create-perl/t/minimal.t
Modified:
trunk/libpdf-create-perl/CHANGES
trunk/libpdf-create-perl/META.yml
trunk/libpdf-create-perl/debian/changelog
trunk/libpdf-create-perl/lib/PDF/Create.pm
trunk/libpdf-create-perl/lib/PDF/Create/Page.pm
trunk/libpdf-create-perl/sample.pl
Modified: trunk/libpdf-create-perl/CHANGES
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpdf-create-perl/CHANGES?rev=20367&op=diff
==============================================================================
--- trunk/libpdf-create-perl/CHANGES (original)
+++ trunk/libpdf-create-perl/CHANGES Fri May 23 20:00:57 2008
@@ -1,3 +1,8 @@
+
+Version 0.09 30.9.2007
+- Markus Baertschi, markus at markus.org
+ Added stringml for multi-line strings
+ Changed get_page_size to case-independent
Version 0.08 3.9.2007
- Markus Baertschi, markus at markus.org
Modified: trunk/libpdf-create-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpdf-create-perl/META.yml?rev=20367&op=diff
==============================================================================
--- trunk/libpdf-create-perl/META.yml (original)
+++ trunk/libpdf-create-perl/META.yml Fri May 23 20:00:57 2008
@@ -1,10 +1,11 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
-name: PDF-Create
-version: 0.08
-version_from: lib/PDF/Create.pm
-installdirs: site
-requires:
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.30_01
+--- #YAML:1.0
+name: PDF-Create
+version: 0.9
+abstract: ~
+license: ~
+generated_by: ExtUtils::MakeMaker version 6.36
+distribution_type: module
+requires:
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.2.html
+ version: 1.2
Modified: trunk/libpdf-create-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpdf-create-perl/debian/changelog?rev=20367&op=diff
==============================================================================
--- trunk/libpdf-create-perl/debian/changelog (original)
+++ trunk/libpdf-create-perl/debian/changelog Fri May 23 20:00:57 2008
@@ -1,3 +1,9 @@
+libpdf-create-perl (0.9-1) UNRELEASED; urgency=low
+
+ * New upstream release.
+
+ -- gregor herrmann <gregoa at debian.org> Fri, 23 May 2008 21:59:39 +0200
+
libpdf-create-perl (0.08-1) unstable; urgency=low
[ gregor herrmann ]
Modified: trunk/libpdf-create-perl/lib/PDF/Create.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpdf-create-perl/lib/PDF/Create.pm?rev=20367&op=diff
==============================================================================
--- trunk/libpdf-create-perl/lib/PDF/Create.pm (original)
+++ trunk/libpdf-create-perl/lib/PDF/Create.pm Fri May 23 20:00:57 2008
@@ -26,7 +26,7 @@
@ISA = qw(Exporter);
@EXPORT = qw();
-$VERSION = 0.08;
+$VERSION = 0.9;
$DEBUG = 0;
sub new {
@@ -445,28 +445,28 @@
my $name = lc(shift);
my %pagesizes = (
- 'a0' => [ 0, 0, 2380, 3368 ],
- 'a1' => [ 0, 0, 1684, 2380 ],
- 'a2' => [ 0, 0, 1190, 1684 ],
- 'a3' => [ 0, 0, 842, 1190 ],
- 'a4' => [ 0, 0, 595, 842 ],
- 'a4L' => [ 0, 0, 842, 595 ],
- 'a5' => [ 0, 0, 421, 595 ],
- 'a6' => [ 0, 0, 297, 421 ],
- 'letter' => [ 0, 0, 612, 792 ],
- 'broadsheet' => [ 0, 0, 1296, 1584 ],
- 'ledger' => [ 0, 0, 1224, 792 ],
- 'tabloid' => [ 0, 0, 792, 1224 ],
- 'legal' => [ 0, 0, 612, 1008 ],
- 'executive' => [ 0, 0, 522, 756 ],
- '36x36' => [ 0, 0, 2592, 2592 ],
+ 'A0' => [ 0, 0, 2380, 3368 ],
+ 'A1' => [ 0, 0, 1684, 2380 ],
+ 'A2' => [ 0, 0, 1190, 1684 ],
+ 'A3' => [ 0, 0, 842, 1190 ],
+ 'A4' => [ 0, 0, 595, 842 ],
+ 'A4L' => [ 0, 0, 842, 595 ],
+ 'A5' => [ 0, 0, 421, 595 ],
+ 'A6' => [ 0, 0, 297, 421 ],
+ 'LETTER' => [ 0, 0, 612, 792 ],
+ 'BROADSHEET' => [ 0, 0, 1296, 1584 ],
+ 'LEDGER' => [ 0, 0, 1224, 792 ],
+ 'TABLOID' => [ 0, 0, 792, 1224 ],
+ 'LEGAL' => [ 0, 0, 612, 1008 ],
+ 'EXECUTIVE' => [ 0, 0, 522, 756 ],
+ '36X36' => [ 0, 0, 2592, 2592 ],
);
- if (!$pagesizes{$name}) {
- $name = "a4";
+ if (!$pagesizes{uc($name)}) {
+ $name = "A4";
}
- $pagesizes{$name};
+ $pagesizes{uc($name)};
}
sub new_page {
@@ -485,6 +485,7 @@
$page->{'rotate'} = $params{'Rotate'} if defined $params{'Rotate'};
$self->{'current_page'} = $page;
+
$page;
}
@@ -895,56 +896,53 @@
=head1 SYNOPSIS
- use PDF::Create;
-
- my $pdf = new PDF::Create('filename' => 'mypdf.pdf',
- 'Version' => 1.2,
- 'PageMode' => 'UseOutlines',
- 'Author' => 'Fabien Tassin',
- 'Title' => 'My title',
- 'CreationDate' => [ localtime ],
+use PDF::Create;
+
+my $pdf = new PDF::Create('filename' => 'mypdf.pdf',
+ 'Version' => 1.2,
+ 'PageMode' => 'UseOutlines',
+ 'Author' => 'John Doe',
+ 'Title' => 'My Title',
+ 'CreationDate' => [ localtime ],
);
- my $root = $pdf->new_page('MediaBox' => [ 0, 0, 612, 792 ]);
-
- # add a A4 sized page
- my $root = $pdf->new_page('MediaBox' => $pdf->get_page_size('A4'));
-
- # Add a page which inherits its attributes from $root
- my $page = $root->new_page;
-
- # Prepare 2 fonts
- my $f1 = $pdf->font('Subtype' => 'Type1',
- 'Encoding' => 'WinAnsiEncoding',
- 'BaseFont' => 'Helvetica');
- my $f2 = $pdf->font('Subtype' => 'Type1',
- 'Encoding' => 'WinAnsiEncoding',
- 'BaseFont' => 'Helvetica-Bold');
-
- # Prepare a Table of Content
- my $toc = $pdf->new_outline('Title' => 'Document',
- 'Destination' => $page);
- $toc->new_outline('Title' => 'Section 1');
- my $s2 = $toc->new_outline('Title' => 'Section 2',
- 'Status' => 'closed');
- $s2->new_outline('Title' => 'Subsection 1');
-
- $page->stringc($f2, 40, 306, 426, "PDF::Create");
- $page->stringc($f1, 20, 306, 396, "version $PDF::Create::VERSION");
-
- # Add another page
- my $page2 = $root->new_page;
- $page2->line(0, 0, 612, 792);
- $page2->line(0, 792, 612, 0);
-
- $toc->new_outline('Title' => 'Section 3');
- $pdf->new_outline('Title' => 'Summary');
-
- # Add something to the first page
- $page->stringc($f1, 20, 306, 300,
- 'by Fabien Tassin <fta at sofaraway.org>');
-
- # Add the missing PDF objects and a the footer then close the file
- $pdf->close;
+# add a A4 sized page
+my $root = $pdf->new_page('MediaBox' => $pdf->get_page_size('A4'));
+
+# Add a page which inherits its attributes from $root
+my $page = $root->new_page;
+
+# Prepare 2 fonts
+my $f1 = $pdf->font('Subtype' => 'Type1',
+ 'Encoding' => 'WinAnsiEncoding',
+ 'BaseFont' => 'Helvetica');
+my $f2 = $pdf->font('Subtype' => 'Type1',
+ 'Encoding' => 'WinAnsiEncoding',
+ 'BaseFont' => 'Helvetica-Bold');
+
+# Prepare a Table of Content
+my $toc = $pdf->new_outline('Title' => 'Document',
+ 'Destination' => $page);
+$toc->new_outline('Title' => 'Section 1');
+my $s2 = $toc->new_outline('Title' => 'Section 2',
+ 'Status' => 'closed');
+$s2->new_outline('Title' => 'Subsection 1');
+
+$page->stringc($f2, 40, 306, 426, "PDF::Create");
+$page->stringc($f1, 20, 306, 396, "version $PDF::Create::VERSION");
+
+# Add another page
+my $page2 = $root->new_page;
+$page2->line(0, 0, 612, 792);
+$page2->line(0, 792, 612, 0);
+
+$toc->new_outline('Title' => 'Section 3');
+$pdf->new_outline('Title' => 'Summary');
+
+# Add something to the first page
+$page->stringc($f1, 20, 306, 300, 'by John Doe <john.doe at example.com>');
+
+# Add the missing PDF objects and a the footer then close the file
+$pdf->close;
=head1 DESCRIPTION
@@ -974,9 +972,7 @@
used:
- filename: destination file that will contain the resulting
- PDF or ...
-
- - fh: ... an already opened filehandle
+ PDF or an already opened filehandle or '-' for stdout.
- Version: can be 1.0 to 1.3 (default: 1.2)
@@ -1012,13 +1008,13 @@
Example:
- my $pdf = new PDF::Create('filename' => 'mypdf.pdf',
- 'Version' => 1.2,
- 'PageMode' => 'UseOutlines',
- 'Author' => 'Fabien Tassin',
- 'Title' => 'My title',
- 'CreationDate' => [ localtime ],
- );
+ my $pdf = new PDF::Create('filename' => 'mypdf.pdf',
+ 'Version' => 1.2,
+ 'PageMode' => 'UseOutlines',
+ 'Author' => 'John Doe',
+ 'Title' => 'My title',
+ 'CreationDate' => [ localtime ],
+ );
The created object is returned.
@@ -1080,6 +1076,8 @@
are measured in default user space units. It must be the reference
of a 4 values array. You can use C<get_page_size> to get the size of
standard paper sizes.
+ C<get_page_size> knows about A0-A6, A4L (landscape), Letter, Legal,
+Broadsheet, Ledger, Tabloid, Executive and 36x36.
- CropBox: Rectangle specifying the default clipping region for
the page when displayed or printed. The default is the value of
@@ -1197,6 +1195,17 @@
Same as C<string> but centered.
+=item C<printnl text font size x y>
+
+Similar to C<string> but parses the string for newline and prints each part
+on a separate line. Lines spacing is the same as the font-size. Returns the
+number of lines.
+
+Note the different parameter sequence. The first call should specify all
+parameters, font is the absolute minimum, a warning will be given for the
+missing y position and 800 will be assumed. All subsequent invocations can
+omit all but the string parameters.
+
=item C<string_width font text>
Return the size of the text using the given font in default user space units.
@@ -1209,6 +1218,11 @@
=item C<set_width w>
Set the width of subsequent lines to w points.
+
+=item C<setrgbcolor r g b>
+
+Set the color of the subsequent drawing operations. R,G and B is a value
+between 0.0 and 1.0.
=head2 Low level drawing methods
@@ -1244,6 +1258,14 @@
Strokes the path.
+A typical usage is
+
+$page->newpath;
+$page->setrgbcolorstroke 0.1 0.3 0.8;
+$page->moveto 100 100;
+$page->lineto 200 100;
+$page->stroke;
+
=item C<closestroke>
Closes and strokes the path.
@@ -1280,13 +1302,13 @@
L<PDF::Create::Page(3)>, L<perl(1)>
-=head1 AUTHOR
+=head1 AUTHORS
Fabien Tassin (fta at sofaraway.org)
GIF and JPEG-support: Michael Gross (mdgrosse at sbox.tugraz.at)
-Maintenence since 2007: Markus Baertschi (markus at markus.org)
+Maintened since 2007: Markus Baertschi (markus at markus.org)
=head1 COPYRIGHT
Modified: trunk/libpdf-create-perl/lib/PDF/Create/Page.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpdf-create-perl/lib/PDF/Create/Page.pm?rev=20367&op=diff
==============================================================================
--- trunk/libpdf-create-perl/lib/PDF/Create/Page.pm (original)
+++ trunk/libpdf-create-perl/lib/PDF/Create/Page.pm Fri May 23 20:00:57 2008
@@ -217,6 +217,7 @@
my $g = shift;
my $b = shift;
+ croak "Error setting colors, need three values" if ! defined $b;
$self->{'pdf'}->page_stream($self);
$self->{'pdf'}->add("$r $g $b RG");
}
@@ -307,6 +308,34 @@
$w += $$font_widths{$fname}[ord $c];
}
$w / 1000;
+}
+
+sub printnl {
+ my $self = shift;
+ my $s = shift;
+ my $font = shift;
+ my $size = shift;
+ my $x = shift;
+ my $y = shift;
+
+ # set up current_x/y used in stringml
+ $self->{'current_y'}=$y if defined $y;
+ carp 'No starting position given, using 800' if ! defined $self->{'current_y'};
+ $self->{'current_y'}=800 if ! defined $self->{'current_y'};
+ $self->{'current_x'}=$x if defined $x;
+ $self->{'current_x'}=20 if ! defined $self->{'current_x'};
+ $self->{'current_size'}=$size if defined $size;
+ $self->{'current_size'}=12 if ! defined $self->{'current_size'};
+ $self->{'current_font'}=$font if defined $font;
+ croak 'No font found !' if ! defined $self->{'current_font'};
+ # print the line(s)
+ my $n = 0;
+ for my $line (split '\n', $s) {
+ $n++;
+ $self->string($self->{'current_font'},$self->{'current_size'},$self->{'current_x'},$self->{'current_y'},$line);
+ $self->{'current_y'} = $self->{'current_y'} - $self->{'current_size'};
+ }
+ return $n;
}
sub image {
Modified: trunk/libpdf-create-perl/sample.pl
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libpdf-create-perl/sample.pl?rev=20367&op=diff
==============================================================================
--- trunk/libpdf-create-perl/sample.pl (original)
+++ trunk/libpdf-create-perl/sample.pl Fri May 23 20:00:57 2008
@@ -3,26 +3,25 @@
# sample PDF::Create usage
#
-BEGIN { unshift @INC, "lib", "../lib" }
use strict;
use PDF::Create;
my $pdf = new PDF::Create('filename' => 'sample.pdf',
- 'Version' => 1.2,
- 'PageMode' => 'UseOutlines',
- 'Author' => 'Fabien Tassin',
- 'Title' => 'Sample Document',
+ 'Version' => 1.2,
+ 'PageMode' => 'UseOutlines',
+ 'Author' => 'John Doe',
+ 'Title' => 'Sample Document',
);
-my $root = $pdf->new_page('MediaBox' => $pdf->get_page_size('A4'));
+my $root = $pdf->new_page('MediaBox' => $pdf->get_page_size('a4'));
# Prepare 2 fonts
my $f1 = $pdf->font('Subtype' => 'Type1',
- 'Encoding' => 'WinAnsiEncoding',
+ 'Encoding' => 'WinAnsiEncoding',
'BaseFont' => 'Helvetica');
my $f2 = $pdf->font('Subtype' => 'Type1',
- 'Encoding' => 'WinAnsiEncoding',
- 'BaseFont' => 'Helvetica-Bold');
+ 'Encoding' => 'WinAnsiEncoding',
+ 'BaseFont' => 'Helvetica-Bold');
# Prepare a Table of Content
my $toc = $pdf->new_outline('Title' => 'Sample Document');
More information about the Pkg-perl-cvs-commits
mailing list