r20365 - in /branches/upstream/libpdf-create-perl/current: CHANGES MANIFEST META.yml TODO 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 19:59:08 UTC 2008


Author: gregoa
Date: Fri May 23 19:59:07 2008
New Revision: 20365

URL: http://svn.debian.org/wsvn/?sc=1&rev=20365
Log:
[svn-upgrade] Integrating new upstream version, libpdf-create-perl (0.9)

Added:
    branches/upstream/libpdf-create-perl/current/TODO
    branches/upstream/libpdf-create-perl/current/t/1-simple.t   (with props)
    branches/upstream/libpdf-create-perl/current/t/2-jpeg.t   (with props)
    branches/upstream/libpdf-create-perl/current/t/3-gif.t   (with props)
    branches/upstream/libpdf-create-perl/current/t/4-graphics.t   (with props)
    branches/upstream/libpdf-create-perl/current/t/5-complex.t   (with props)
    branches/upstream/libpdf-create-perl/current/t/pdf-logo.gif   (with props)
    branches/upstream/libpdf-create-perl/current/t/pdf-logo.jpg   (with props)
Removed:
    branches/upstream/libpdf-create-perl/current/t/minimal.t
Modified:
    branches/upstream/libpdf-create-perl/current/CHANGES
    branches/upstream/libpdf-create-perl/current/MANIFEST
    branches/upstream/libpdf-create-perl/current/META.yml
    branches/upstream/libpdf-create-perl/current/lib/PDF/Create.pm
    branches/upstream/libpdf-create-perl/current/lib/PDF/Create/Page.pm
    branches/upstream/libpdf-create-perl/current/sample.pl

Modified: branches/upstream/libpdf-create-perl/current/CHANGES
URL: http://svn.debian.org/wsvn/branches/upstream/libpdf-create-perl/current/CHANGES?rev=20365&op=diff
==============================================================================
--- branches/upstream/libpdf-create-perl/current/CHANGES (original)
+++ branches/upstream/libpdf-create-perl/current/CHANGES Fri May 23 19:59:07 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: branches/upstream/libpdf-create-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/branches/upstream/libpdf-create-perl/current/MANIFEST?rev=20365&op=diff
==============================================================================
Binary files - no diff available.

Modified: branches/upstream/libpdf-create-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libpdf-create-perl/current/META.yml?rev=20365&op=diff
==============================================================================
--- branches/upstream/libpdf-create-perl/current/META.yml (original)
+++ branches/upstream/libpdf-create-perl/current/META.yml Fri May 23 19:59:07 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

Added: branches/upstream/libpdf-create-perl/current/TODO
URL: http://svn.debian.org/wsvn/branches/upstream/libpdf-create-perl/current/TODO?rev=20365&op=file
==============================================================================
--- branches/upstream/libpdf-create-perl/current/TODO (added)
+++ branches/upstream/libpdf-create-perl/current/TODO Fri May 23 19:59:07 2008
@@ -1,0 +1,3 @@
+
+18.11.07 - Add the image stuff to perldoc
+

Modified: branches/upstream/libpdf-create-perl/current/lib/PDF/Create.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libpdf-create-perl/current/lib/PDF/Create.pm?rev=20365&op=diff
==============================================================================
--- branches/upstream/libpdf-create-perl/current/lib/PDF/Create.pm (original)
+++ branches/upstream/libpdf-create-perl/current/lib/PDF/Create.pm Fri May 23 19:59:07 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: branches/upstream/libpdf-create-perl/current/lib/PDF/Create/Page.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libpdf-create-perl/current/lib/PDF/Create/Page.pm?rev=20365&op=diff
==============================================================================
--- branches/upstream/libpdf-create-perl/current/lib/PDF/Create/Page.pm (original)
+++ branches/upstream/libpdf-create-perl/current/lib/PDF/Create/Page.pm Fri May 23 19:59:07 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: branches/upstream/libpdf-create-perl/current/sample.pl
URL: http://svn.debian.org/wsvn/branches/upstream/libpdf-create-perl/current/sample.pl?rev=20365&op=diff
==============================================================================
--- branches/upstream/libpdf-create-perl/current/sample.pl (original)
+++ branches/upstream/libpdf-create-perl/current/sample.pl Fri May 23 19:59:07 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');

Added: branches/upstream/libpdf-create-perl/current/t/1-simple.t
URL: http://svn.debian.org/wsvn/branches/upstream/libpdf-create-perl/current/t/1-simple.t?rev=20365&op=file
==============================================================================
--- branches/upstream/libpdf-create-perl/current/t/1-simple.t (added)
+++ branches/upstream/libpdf-create-perl/current/t/1-simple.t Fri May 23 19:59:07 2008
@@ -1,0 +1,49 @@
+#!/usr/bin/perl -w
+#
+# 01-simple.t
+#
+# simple test page
+#
+
+BEGIN { unshift @INC, "lib", "../lib" }
+use strict;
+use PDF::Create;
+
+print "1..5\n";
+
+my $pdf = new PDF::Create('filename' => 'simple.pdf',
+		  	  'Version'  => 1.2,
+			  'PageMode' => 'UseOutlines',
+			  'Author'   => 'Markus Baertschi',
+			  'Title'    => 'Simple Test Document',
+			);
+if ($pdf) { print "ok 1 # pdf created\n";
+} else { print "Bail out!  # pdf creation failed\n"; }
+
+my $root = $pdf->new_page('MediaBox' => $pdf->get_page_size('A4'));
+if ($root) { print "ok 2 # root page created\n";
+} else { print "Bail out! # root page creation failed\n"; }
+
+# Prepare 2 fonts
+my $f1 = $pdf->font('Subtype'  => 'Type1',
+   	            'Encoding' => 'WinAnsiEncoding',
+	            'BaseFont' => 'Helvetica');
+if ($f1) { print "ok 3 # font defined\n";
+} else { print "not ok 3 # font definition failed\n"; }
+
+# Add a page which inherits its attributes from $root
+my $page = $root->new_page;
+if ($root) { print "ok 4 # page defined\n";
+} else { print "not ok 4 # page definition failed\n"; }
+
+# Write some text to the page
+$page->stringc($f1, 40, 306, 700, 'PDF::Create');
+$page->stringc($f1, 20, 306, 650, "version $PDF::Create::VERSION");
+$page->stringc($f1, 20, 306, 600, 'Simple Test Document');
+$page->stringc($f1, 20, 300, 300, 'Fabien Tassin');
+$page->stringc($f1, 20, 300, 250, 'Markus Baertschi (markus at markus.org)');
+
+# Wrap up the PDF and close the file
+$pdf->close;
+
+print "ok 5 \# test $0 ended\n";

Propchange: branches/upstream/libpdf-create-perl/current/t/1-simple.t
------------------------------------------------------------------------------
    svn:executable = *

Added: branches/upstream/libpdf-create-perl/current/t/2-jpeg.t
URL: http://svn.debian.org/wsvn/branches/upstream/libpdf-create-perl/current/t/2-jpeg.t?rev=20365&op=file
==============================================================================
--- branches/upstream/libpdf-create-perl/current/t/2-jpeg.t (added)
+++ branches/upstream/libpdf-create-perl/current/t/2-jpeg.t Fri May 23 19:59:07 2008
@@ -1,0 +1,47 @@
+#!/usr/bin/perl -w
+#
+# page-jpeg.t
+#
+# simple test page with jpeg image
+#
+
+BEGIN { unshift @INC, "lib", "../lib" }
+use strict;
+use PDF::Create;
+
+print "1..1\n";
+
+my $pdf = new PDF::Create('filename' => 'jpeg.pdf',
+		  	  'Version'  => 1.2,
+			  'PageMode' => 'UseOutlines',
+			  'Author'   => 'Markus Baertschi',
+			  'Title'    => 'Simple JPEG Test Document',
+			);
+
+my $root = $pdf->new_page('MediaBox' => $pdf->get_page_size('A4'));
+
+# Prepare 2 fonts
+my $f1 = $pdf->font('Subtype'  => 'Type1',
+   	            'Encoding' => 'WinAnsiEncoding',
+	            'BaseFont' => 'Helvetica');
+
+# Add a page which inherits its attributes from $root
+my $page = $root->new_page;
+
+# Write some text to the page
+$page->stringc($f1, 40, 306, 700, 'PDF::Create');
+$page->stringc($f1, 20, 306, 650, "version $PDF::Create::VERSION");
+$page->stringc($f1, 20, 306, 600, 'Simple JPEG Test Document');
+$page->stringc($f1, 20, 300, 300, 'Fabien Tassin');
+$page->stringc($f1, 20, 300, 250, 'Markus Baertschi (markus at markus.org)');
+
+# Add a JPEG image
+$page->string($f1, 20, 200, 400, 'JPEG Image:');
+my $img1 = $pdf->image('pdf-logo.jpg');
+$page->image('image'=>$img1, 'xscale'=>0.2,'yscale'=>0.2,'xpos'=>350,'ypos'=>400);
+
+# Wrap up the PDF and close the file
+$pdf->close;
+
+print "ok 1 # test $0 ended\n";
+

Propchange: branches/upstream/libpdf-create-perl/current/t/2-jpeg.t
------------------------------------------------------------------------------
    svn:executable = *

Added: branches/upstream/libpdf-create-perl/current/t/3-gif.t
URL: http://svn.debian.org/wsvn/branches/upstream/libpdf-create-perl/current/t/3-gif.t?rev=20365&op=file
==============================================================================
--- branches/upstream/libpdf-create-perl/current/t/3-gif.t (added)
+++ branches/upstream/libpdf-create-perl/current/t/3-gif.t Fri May 23 19:59:07 2008
@@ -1,0 +1,46 @@
+#!/usr/bin/perl -w
+#
+# page-jpeg.t
+#
+# simple test page with jpeg image
+#
+
+BEGIN { unshift @INC, "lib", "../lib" }
+use strict;
+use PDF::Create;
+
+print "1..1\n";
+
+my $pdf = new PDF::Create('filename' => 'gif.pdf',
+		  	  'Version'  => 1.2,
+			  'PageMode' => 'UseOutlines',
+			  'Author'   => 'Markus Baertschi',
+			  'Title'    => 'Simple GIF Test Document',
+			);
+
+my $root = $pdf->new_page('MediaBox' => $pdf->get_page_size('A4'));
+
+# Prepare 2 fonts
+my $f1 = $pdf->font('Subtype'  => 'Type1',
+   	            'Encoding' => 'WinAnsiEncoding',
+	            'BaseFont' => 'Helvetica');
+
+# Add a page which inherits its attributes from $root
+my $page = $root->new_page;
+
+# Write some text to the page
+$page->stringc($f1, 40, 306, 700, 'PDF::Create');
+$page->stringc($f1, 20, 306, 650, "version $PDF::Create::VERSION");
+$page->stringc($f1, 20, 306, 600, 'Simple GIF Test Document');
+$page->stringc($f1, 20, 300, 300, 'Fabien Tassin');
+$page->stringc($f1, 20, 300, 250, 'Markus Baertschi (markus at markus.org)');
+
+# Add a JPEG image
+$page->string($f1, 20, 200, 400, 'GIF Image:');
+my $img1 = $pdf->image('pdf-logo.gif');
+$page->image('image'=>$img1, 'xscale'=>0.2,'yscale'=>0.2,'xpos'=>350,'ypos'=>400);
+
+# Wrap up the PDF and close the file
+$pdf->close;
+
+print "ok 1 # test $0 ended\n";

Propchange: branches/upstream/libpdf-create-perl/current/t/3-gif.t
------------------------------------------------------------------------------
    svn:executable = *

Added: branches/upstream/libpdf-create-perl/current/t/4-graphics.t
URL: http://svn.debian.org/wsvn/branches/upstream/libpdf-create-perl/current/t/4-graphics.t?rev=20365&op=file
==============================================================================
--- branches/upstream/libpdf-create-perl/current/t/4-graphics.t (added)
+++ branches/upstream/libpdf-create-perl/current/t/4-graphics.t Fri May 23 19:59:07 2008
@@ -1,0 +1,65 @@
+#!/usr/bin/perl -w
+#
+# 01-simple.t
+#
+# simple test page
+#
+
+BEGIN { unshift @INC, "lib", "../lib" }
+use strict;
+use PDF::Create;
+
+print "1..1\n";
+
+my $pdf = new PDF::Create('filename' => '4-graphics.pdf',
+		  	  'Version'  => 1.2,
+			  'PageMode' => 'UseOutlines',
+			  'Author'   => 'Markus Baertschi',
+			  'Title'    => 'Simple Graphics Document',
+			);
+
+my $root = $pdf->new_page('MediaBox' => $pdf->get_page_size('A4'));
+
+# Prepare 2 fonts
+my $f1 = $pdf->font('Subtype'  => 'Type1',
+   	            'Encoding' => 'WinAnsiEncoding',
+	            'BaseFont' => 'Helvetica');
+
+# Add a page which inherits its attributes from $root
+my $page = $root->new_page;
+
+# Write some text to the page
+$page->stringc($f1, 40, 306, 750, 'PDF::Create');
+$page->stringc($f1, 20, 306, 710, "version $PDF::Create::VERSION");
+$page->stringc($f1, 20, 306, 680, 'Simple Graphics Document');
+$page->stringc($f1, 20, 300, 150, 'Fabien Tassin');
+$page->stringc($f1, 20, 300, 130, 'Markus Baertschi (markus at markus.org)');
+
+# Draw some graphics
+$page->line(100, 200, 100, 600);
+$page->line(100, 200, 500, 200);
+$page->line(100, 600, 500, 600);
+$page->line(500, 200, 500, 600);
+$page->line(300, 200, 300, 600);
+$page->line(100, 400, 500, 400);
+for (my $x = 100; $x<=500; $x=$x+25) { $page->line($x, 395, $x, 405); }
+for (my $y = 200; $y<=600; $y=$y+25) { $page->line(295, $y, 305, $y); }
+
+$page->set_width(2);
+my ($x,$y,$x2,$y2);
+$page->newpath;
+$page->setrgbcolorstroke(0.1,0.2,1);
+$page->moveto(100,400);
+for ($x = -3.14; $x<=3.14; $x=$x+0.03) {
+  $y=sin($x);
+  $y2=400+int($y*2000)/10;
+  $x2=300+int($x*2000/3.14)/10;
+  $page->lineto($x2,$y2);
+}
+$page->stroke;
+
+# Wrap up the PDF and close the file
+$pdf->close;
+
+print "ok 1 # test $0 ended\n";
+

Propchange: branches/upstream/libpdf-create-perl/current/t/4-graphics.t
------------------------------------------------------------------------------
    svn:executable = *

Added: branches/upstream/libpdf-create-perl/current/t/5-complex.t
URL: http://svn.debian.org/wsvn/branches/upstream/libpdf-create-perl/current/t/5-complex.t?rev=20365&op=file
==============================================================================
--- branches/upstream/libpdf-create-perl/current/t/5-complex.t (added)
+++ branches/upstream/libpdf-create-perl/current/t/5-complex.t Fri May 23 19:59:07 2008
@@ -1,0 +1,42 @@
+#!/usr/bin/perl -w
+#
+# page-simple.t
+#
+# simple test page
+#
+
+BEGIN { unshift @INC, "lib", "../lib" }
+use strict;
+use PDF::Create;
+
+print "1..1\n";
+
+my $pdf = new PDF::Create('filename' => 'page-simple.pdf',
+		  	  'Version'  => 1.2,
+			  'PageMode' => 'UseOutlines',
+			  'Author'   => 'Markus Baertschi',
+			  'Title'    => 'Simple Test Document',
+			);
+
+my $root = $pdf->new_page('MediaBox' => $pdf->get_page_size('A4'));
+
+# Prepare 2 fonts
+my $f1 = $pdf->font('Subtype'  => 'Type1',
+   	            'Encoding' => 'WinAnsiEncoding',
+	            'BaseFont' => 'Helvetica');
+
+# Add a page which inherits its attributes from $root
+my $page = $root->new_page;
+
+# Write some text to the page
+$page->stringc($f1, 40, 306, 700, 'PDF::Create');
+$page->stringc($f1, 20, 306, 650, "version $PDF::Create::VERSION");
+$page->stringc($f1, 20, 306, 600, 'Simple Test Document');
+$page->stringc($f1, 20, 300, 300, 'Fabien Tassin');
+$page->stringc($f1, 20, 300, 250, 'Markus Baertschi (markus at markus.org)');
+
+# Wrap up the PDF and close the file
+$pdf->close;
+
+print "ok 1 # test $0 ended\n";
+

Propchange: branches/upstream/libpdf-create-perl/current/t/5-complex.t
------------------------------------------------------------------------------
    svn:executable = *

Added: branches/upstream/libpdf-create-perl/current/t/pdf-logo.gif
URL: http://svn.debian.org/wsvn/branches/upstream/libpdf-create-perl/current/t/pdf-logo.gif?rev=20365&op=file
==============================================================================
Binary file - no diff available.

Propchange: branches/upstream/libpdf-create-perl/current/t/pdf-logo.gif
------------------------------------------------------------------------------
    svn:executable = *

Propchange: branches/upstream/libpdf-create-perl/current/t/pdf-logo.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: branches/upstream/libpdf-create-perl/current/t/pdf-logo.jpg
URL: http://svn.debian.org/wsvn/branches/upstream/libpdf-create-perl/current/t/pdf-logo.jpg?rev=20365&op=file
==============================================================================
Binary file - no diff available.

Propchange: branches/upstream/libpdf-create-perl/current/t/pdf-logo.jpg
------------------------------------------------------------------------------
    svn:executable = *

Propchange: branches/upstream/libpdf-create-perl/current/t/pdf-logo.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream




More information about the Pkg-perl-cvs-commits mailing list