diff options
Diffstat (limited to 'lib/PDF/Builder/Resource/XObject')
19 files changed, 358 insertions, 101 deletions
diff --git a/lib/PDF/Builder/Resource/XObject/Form.pm b/lib/PDF/Builder/Resource/XObject/Form.pm index a251b4c..16ab2af 100644 --- a/lib/PDF/Builder/Resource/XObject/Form.pm +++ b/lib/PDF/Builder/Resource/XObject/Form.pm @@ -5,8 +5,8 @@ use base 'PDF::Builder::Resource::XObject'; use strict; use warnings; -our $VERSION = '3.025'; # VERSION -our $LAST_UPDATE = '2.031'; # manually update whenever code is changed +our $VERSION = '3.026'; # VERSION +our $LAST_UPDATE = '3.026'; # manually update whenever code is changed use PDF::Builder::Basic::PDF::Utils; @@ -16,12 +16,16 @@ PDF::Builder::Resource::XObject::Form - Base class for external form objects =head1 METHODS -=over +=head2 new + + $form = PDF::Builder::Resource::XObject::Form->new($pdf) -=item $form = PDF::Builder::Resource::XObject::Form->new($pdf) +=over Creates a form resource. +=back + =cut sub new { @@ -35,9 +39,15 @@ sub new { return $self; } -=item ($llx, $lly, $urx, $ury) = $form->bbox($llx, $lly, $urx, $ury) +=head2 bbox -Get or set the coordinates of the form object's bounding box + ($llx, $lly, $urx, $ury) = $form->bbox($llx, $lly, $urx, $ury) + +=over + +Get or set the coordinates of the form object's bounding box. + +=back =cut @@ -51,14 +61,20 @@ sub bbox { return map { $_->val() } $self->{'BBox'}->elements(); } -=item $resource = $form->resource($type, $key) +=head2 resource -=item $form->resource($type, $key, $object, $force) + $resource = $form->resource($type, $key) + + $form->resource($type, $key, $object, $force) + +=over Get or add a resource required by the form's contents, such as a Font, XObject, ColorSpace, etc. By default, an existing C<$key> will not be overwritten. Set C<$force> to override this behavior. +=back + =cut sub resource { @@ -87,8 +103,4 @@ sub resource { return $dict; } -=back - -=cut - 1; diff --git a/lib/PDF/Builder/Resource/XObject/Form/BarCode.pm b/lib/PDF/Builder/Resource/XObject/Form/BarCode.pm index caf94ac..dc410e4 100644 --- a/lib/PDF/Builder/Resource/XObject/Form/BarCode.pm +++ b/lib/PDF/Builder/Resource/XObject/Form/BarCode.pm @@ -5,8 +5,8 @@ use base 'PDF::Builder::Resource::XObject::Form::Hybrid'; use strict; use warnings; -our $VERSION = '3.025'; # VERSION -our $LAST_UPDATE = '3.024'; # manually update whenever code is changed +our $VERSION = '3.026'; # VERSION +our $LAST_UPDATE = '3.026'; # manually update whenever code is changed use PDF::Builder::Util; use PDF::Builder::Basic::PDF::Utils; @@ -17,12 +17,16 @@ PDF::Builder::Resource::XObject::Form::BarCode - Base class for one-dimensional =head1 METHODS -=over +=head2 new + + $barcode = PDF::Builder::Resource::XObject::Form::BarCode->new($pdf, %options) -=item $barcode = PDF::Builder::Resource::XObject::Form::BarCode->new($pdf, %options) +=over Creates a barcode form resource. +=back + =cut sub new { @@ -179,7 +183,15 @@ sub drawbar { return; } -=item $width = $barcode->width() +=head2 width + + $width = $barcode->width() + +=over + +Returns the width of the bar code. + +=back =cut @@ -189,18 +201,23 @@ sub width { return $self->{' w'}; } -=item $height = $barcode->height() +=head2 height + + $height = $barcode->height() + +=over + +Returns the height of the bar code. + +=back =cut + sub height { my $self = shift; return $self->{' h'}; } -=back - -=cut - 1; diff --git a/lib/PDF/Builder/Resource/XObject/Form/BarCode/codabar.pm b/lib/PDF/Builder/Resource/XObject/Form/BarCode/codabar.pm index f6276aa..dbc3c7e 100644 --- a/lib/PDF/Builder/Resource/XObject/Form/BarCode/codabar.pm +++ b/lib/PDF/Builder/Resource/XObject/Form/BarCode/codabar.pm @@ -5,13 +5,26 @@ use base 'PDF::Builder::Resource::XObject::Form::BarCode'; use strict; use warnings; -our $VERSION = '3.025'; # VERSION -our $LAST_UPDATE = '3.024'; # manually update whenever code is changed +our $VERSION = '3.026'; # VERSION +our $LAST_UPDATE = '3.026'; # manually update whenever code is changed =head1 NAME PDF::Builder::Resource::XObject::Form::BarCode::codabar - specific information for CodaBar bar codes. Inherits from L<PDF::Builder::Resource::XObject::Form::BarCode> +=head1 METHODS + +=head2 new + + PDF::Builder::Resource::XObject::Form::BarCode::codabar->new() + +=over + +Create a Codabar bar code object. Note that it is invoked from the Builder.pm +level method! + +=back + =cut # TBD document code, caption options diff --git a/lib/PDF/Builder/Resource/XObject/Form/BarCode/code128.pm b/lib/PDF/Builder/Resource/XObject/Form/BarCode/code128.pm index 1d582ae..93fc5bc 100644 --- a/lib/PDF/Builder/Resource/XObject/Form/BarCode/code128.pm +++ b/lib/PDF/Builder/Resource/XObject/Form/BarCode/code128.pm @@ -5,8 +5,8 @@ use base 'PDF::Builder::Resource::XObject::Form::BarCode'; use strict; use warnings; -our $VERSION = '3.025'; # VERSION -our $LAST_UPDATE = '3.024'; # manually update whenever code is changed +our $VERSION = '3.026'; # VERSION +our $LAST_UPDATE = '3.026'; # manually update whenever code is changed =head1 NAME @@ -14,11 +14,14 @@ PDF::Builder::Resource::XObject::Form::BarCode::code128 - Code 128 and EAN-128 b =head1 METHODS -=over +=head2 new + + $res = PDF::Builder::Resource::XObject::Form::BarCode::code128->new($pdf, %options) -=item $res = PDF::Builder::Resource::XObject::Form::BarCode::code128->new($pdf, %options) +=over Returns a code128 object. Use 'ean' option to encode using EAN128 mode. +Note that this should be invoked via the Builder.pm method! =back diff --git a/lib/PDF/Builder/Resource/XObject/Form/BarCode/code3of9.pm b/lib/PDF/Builder/Resource/XObject/Form/BarCode/code3of9.pm index eba3c9f..d937786 100644 --- a/lib/PDF/Builder/Resource/XObject/Form/BarCode/code3of9.pm +++ b/lib/PDF/Builder/Resource/XObject/Form/BarCode/code3of9.pm @@ -5,13 +5,26 @@ use base 'PDF::Builder::Resource::XObject::Form::BarCode'; use strict; use warnings; -our $VERSION = '3.025'; # VERSION -our $LAST_UPDATE = '3.024'; # manually update whenever code is changed +our $VERSION = '3.026'; # VERSION +our $LAST_UPDATE = '3.026'; # manually update whenever code is changed =head1 NAME PDF::Builder::Resource::XObject::Form::BarCode::code3of9 - specific information for 3-of-9 bar codes. Inherits from L<PDF::Builder::Resource::XObject::Form::BarCode> +=head1 METHODS + +=head2 new + + PDF::Builder::Resource::XObject::Form::BarCode::code3of9->new() + +=over + +Create a Code 3 of 9 bar code object. Note that it is invoked from the +Builder.pm level method! + +=back + =cut sub new { diff --git a/lib/PDF/Builder/Resource/XObject/Form/BarCode/ean13.pm b/lib/PDF/Builder/Resource/XObject/Form/BarCode/ean13.pm index ecdd89e..57bd07c 100644 --- a/lib/PDF/Builder/Resource/XObject/Form/BarCode/ean13.pm +++ b/lib/PDF/Builder/Resource/XObject/Form/BarCode/ean13.pm @@ -5,13 +5,26 @@ use base 'PDF::Builder::Resource::XObject::Form::BarCode'; use strict; use warnings; -our $VERSION = '3.025'; # VERSION -our $LAST_UPDATE = '3.024'; # manually update whenever code is changed +our $VERSION = '3.026'; # VERSION +our $LAST_UPDATE = '3.026'; # manually update whenever code is changed =head1 NAME PDF::Builder::Resource::XObject::Form::BarCode::ean13 - specific information for EAN-13 bar codes. Inherits from L<PDF::Builder::Resource::XObject::Form::BarCode> +=head1 METHODS + +=head2 new + + PDF::Builder::Resource::XObject::Form::BarCode::ean13->new() + +=over + +Create an EAN-13 bar code object. Note that it is invoked from the Builder.pm +level method! + +=back + =cut sub new { diff --git a/lib/PDF/Builder/Resource/XObject/Form/BarCode/int2of5.pm b/lib/PDF/Builder/Resource/XObject/Form/BarCode/int2of5.pm index 8294a65..a0a7387 100644 --- a/lib/PDF/Builder/Resource/XObject/Form/BarCode/int2of5.pm +++ b/lib/PDF/Builder/Resource/XObject/Form/BarCode/int2of5.pm @@ -5,12 +5,25 @@ use base 'PDF::Builder::Resource::XObject::Form::BarCode'; use strict; use warnings; -our $VERSION = '3.025'; # VERSION -our $LAST_UPDATE = '3.024'; # manually update whenever code is changed +our $VERSION = '3.026'; # VERSION +our $LAST_UPDATE = '3.026'; # manually update whenever code is changed =head1 NAME -PDF::Builder::Resource::XObject::Form::BarCode::int2of5 - specific information for int 2-of-5 bar codes. Inherits from L<PDF::Builder::Resource::XObject::Form::BarCode> +PDF::Builder::Resource::XObject::Form::BarCode::int2of5 - specific information for interleaved 2-of-5 bar codes. Inherits from L<PDF::Builder::Resource::XObject::Form::BarCode> + +=head1 METHODS + +=head2 new + + PDF::Builder::Resource::XObject::Form::BarCode::int2of5->new() + +=over + +Create an Interleaved 2 of 5 bar code object. Note that it is invoked from the +Builder.pm level method! + +=back =cut diff --git a/lib/PDF/Builder/Resource/XObject/Form/Hybrid.pm b/lib/PDF/Builder/Resource/XObject/Form/Hybrid.pm index 182672c..97238bf 100644 --- a/lib/PDF/Builder/Resource/XObject/Form/Hybrid.pm +++ b/lib/PDF/Builder/Resource/XObject/Form/Hybrid.pm @@ -5,8 +5,8 @@ use base qw(PDF::Builder::Content PDF::Builder::Content::Text PDF::Builder::Reso use strict; use warnings; -our $VERSION = '3.025'; # VERSION -our $LAST_UPDATE = '3.016'; # manually update whenever code is changed +our $VERSION = '3.026'; # VERSION +our $LAST_UPDATE = '3.026'; # manually update whenever code is changed use PDF::Builder::Basic::PDF::Dict; use PDF::Builder::Basic::PDF::Utils; @@ -15,6 +15,18 @@ use PDF::Builder::Resource::XObject::Form; PDF::Builder::Resource::XObject::Form::Hybrid - support routines for Forms. Inherits from L<PDF::Builder::Content>, L<PDF::Builder::Content::Text>, and L<PDF::Builder::Resource::XObject::Form> +=head1 METHODS + +=head2 new + + PDF::Builder::Resource::XObject::Form->new(args) + +=over + +Create a new object for a form. + +=back + =cut sub new { @@ -27,7 +39,7 @@ sub new { $self->{' charspace'} = 0; $self->{' hscale'} = 100; $self->{' wordspace'} = 0; - $self->{' lead'} = 0; + $self->{' leading'} = 0; $self->{' rise'} = 0; $self->{' render'} = 0; $self->{' matrix'} = [1, 0, 0, 1, 0, 0]; @@ -57,7 +69,7 @@ sub outobjdeep { # # missing: stream, poststream, apiistext # # added: api, apipdf, apipage # foreach my $key (qw(api apipdf apipage font fontsize charspace hscale -# wordspace lead rise render matrix fillcolor +# wordspace leading rise render matrix fillcolor # strokecolor translate scale skew rotate)) { # delete $self->{" $key"}; # } diff --git a/lib/PDF/Builder/Resource/XObject/Image.pm b/lib/PDF/Builder/Resource/XObject/Image.pm index fec9b71..5428f08 100644 --- a/lib/PDF/Builder/Resource/XObject/Image.pm +++ b/lib/PDF/Builder/Resource/XObject/Image.pm @@ -5,8 +5,8 @@ use base 'PDF::Builder::Resource::XObject'; use strict; use warnings; -our $VERSION = '3.025'; # VERSION -our $LAST_UPDATE = '3.017'; # manually update whenever code is changed +our $VERSION = '3.026'; # VERSION +our $LAST_UPDATE = '3.026'; # manually update whenever code is changed use PDF::Builder::Basic::PDF::Utils; @@ -16,12 +16,16 @@ PDF::Builder::Resource::XObject::Image - Base class for external raster image ob =head1 METHODS -=over +=head2 new + + $image = PDF::Builder::Resource::XObject::Image->new($pdf, $name) -=item $image = PDF::Builder::Resource::XObject::Image->new($pdf, $name) +=over Returns an image resource object. +=back + =cut sub new { @@ -34,9 +38,22 @@ sub new { return $self; } -=item $width = $image->width($width) +=head2 width + + $width = $image->width() + +=over + +Get the width (in points) of the image object. + +B<Note> that this function also has the ability to I<set> the width, +by giving the new width (in points), but it appears that it never +worked correctly. The I<set> capability has been B<deprecated>, and +is scheduled to be removed some time after October, 2025. If you are +using the C<width()> method in some manner to I<set> the image width, +please let us know, so we can plan to keep it enabled! -Get or set the width value for the image object. +=back =cut @@ -47,9 +64,22 @@ sub width { return $self->{'Width'}->val(); } -=item $height = $image->height($height) +=head2 height + + $height = $image->height() + +=over + +Get the height (in points) of the image object. -Get or set the height value for the image object. +B<Note> that this function also has the ability to I<set> the height, +by giving the new height (in points), but it appears that it never +worked correctly. The I<set> capability has been B<deprecated>, and +is scheduled to be removed some time after October, 2025. If you are +using the C<height()> method in some manner to I<set> the image height, +please let us know, so we can plan to keep it enabled! + +=back =cut @@ -60,10 +90,38 @@ sub height { return $self->{'Height'}->val(); } -=item $image->smask($xobject) +## probably not useful, so do not add, for now +#=head2 bbox +# +# ($x1,$x2, $w,$h) = $image->bbox() +# +#=over +# +#Get the image dimensions similarly to a form's I<bounding box>. +#Note that the C<$x1> and C<$x2> values will always be 0. +# +#This method is offered as an alternative to the C<width> and C<height> methods. +# +#=back +# +#=cut +# +#sub bbox { +# my $self = shift(); +# my @bb = (0,0, $self->width(),$self->height()); +# return @bb; +#} + +=head2 smask + + $image->smask($xobject) + +=over Set the soft-mask image object. +=back + =cut sub smask { @@ -73,13 +131,19 @@ sub smask { return $self; } -=item $image->mask(@color_range) +=head2 mask + + $image->mask(@color_range) -=item $image->mask($xobject) + $image->mask($xobject) + +=over Set the mask to an image mask XObject or an array containing a range of colors to be applied as a color key mask. +=back + =cut sub mask { @@ -96,9 +160,13 @@ sub mask { # imask() functionality rolled into mask() -=item $image->colorspace($name) +=head2 colorspace + + $image->colorspace($name) -=item $image->colorspace($array) + $image->colorspace($array) + +=over Set the color space used by the image. Depending on the color space, this will either be just the name of the color space, or it will be an @@ -108,6 +176,8 @@ If passing an array, parameters must already be encoded as PDF objects. The array itself may also be a PDF object. If not, one will be created. +=back + =cut sub colorspace { @@ -124,10 +194,16 @@ sub colorspace { return $self; } -=item $image->bits_per_component($integer) +=head2 bits_per_component + + $image->bits_per_component($integer) + +=over Set the number of bits used to represent each color component. +=back + =cut sub bits_per_component { @@ -140,8 +216,4 @@ sub bits_per_component { # bpc() renamed to bits_per_component() -=back - -=cut - 1; diff --git a/lib/PDF/Builder/Resource/XObject/Image/GD.pm b/lib/PDF/Builder/Resource/XObject/Image/GD.pm index c3e091a..2514bde 100644 --- a/lib/PDF/Builder/Resource/XObject/Image/GD.pm +++ b/lib/PDF/Builder/Resource/XObject/Image/GD.pm @@ -5,8 +5,8 @@ use base 'PDF::Builder::Resource::XObject::Image'; use strict; use warnings; -our $VERSION = '3.025'; # VERSION -our $LAST_UPDATE = '3.024'; # manually update whenever code is changed +our $VERSION = '3.026'; # VERSION +our $LAST_UPDATE = '3.026'; # manually update whenever code is changed use PDF::Builder::Util; use PDF::Builder::Basic::PDF::Utils; @@ -18,9 +18,11 @@ PDF::Builder::Resource::XObject::Image::GD - support routines for Graphics Devel =head1 METHODS -=over +=head2 new -=item $res = PDF::Builder::Resource::XObject::Image::GD->new($pdf, $file, %opts) + $res = PDF::Builder::Resource::XObject::Image::GD->new($pdf, $file, %opts) + +=over Options: @@ -36,6 +38,9 @@ Use lossless compression. =back +An image object is created from GD input. Note that this should be invoked +from Builder.pm's method. + =back =cut diff --git a/lib/PDF/Builder/Resource/XObject/Image/GIF.pm b/lib/PDF/Builder/Resource/XObject/Image/GIF.pm index 6617a48..e8e91b7 100644 --- a/lib/PDF/Builder/Resource/XObject/Image/GIF.pm +++ b/lib/PDF/Builder/Resource/XObject/Image/GIF.pm @@ -5,8 +5,8 @@ use base 'PDF::Builder::Resource::XObject::Image'; use strict; use warnings; -our $VERSION = '3.025'; # VERSION -our $LAST_UPDATE = '3.024'; # manually update whenever code is changed +our $VERSION = '3.026'; # VERSION +our $LAST_UPDATE = '3.026'; # manually update whenever code is changed use IO::File; use PDF::Builder::Util; @@ -162,6 +162,21 @@ sub deGIF { return $out; } +=head1 METHODS + +=head2 new + + PDF::Builder::Resource::XObject::Image::GIF->new() + +=over + +Create an image object from a GIF input file. +Remember that this should be invoked via the Builder.pm method! + +=back + +=cut + sub new { my ($class, $pdf, $file, %opts) = @_; # copy dashed option names to preferred undashed names diff --git a/lib/PDF/Builder/Resource/XObject/Image/JPEG.pm b/lib/PDF/Builder/Resource/XObject/Image/JPEG.pm index ed2307e..86b1ef2 100644 --- a/lib/PDF/Builder/Resource/XObject/Image/JPEG.pm +++ b/lib/PDF/Builder/Resource/XObject/Image/JPEG.pm @@ -5,8 +5,8 @@ use base 'PDF::Builder::Resource::XObject::Image'; use strict; use warnings; -our $VERSION = '3.025'; # VERSION -our $LAST_UPDATE = '3.024'; # manually update whenever code is changed +our $VERSION = '3.026'; # VERSION +our $LAST_UPDATE = '3.026'; # manually update whenever code is changed use IO::File; use PDF::Builder::Util; @@ -19,9 +19,11 @@ PDF::Builder::Resource::XObject::Image::JPEG - support routines for JPEG image l =head1 METHODS -=over +=head2 new + + $res = PDF::Builder::Resource::XObject::Image::JPEG->new($pdf, $file, %opts) -=item $res = PDF::Builder::Resource::XObject::Image::JPEG->new($pdf, $file, %opts) +=over Options: diff --git a/lib/PDF/Builder/Resource/XObject/Image/PNG.pm b/lib/PDF/Builder/Resource/XObject/Image/PNG.pm index ae04d3a..f44a8f6 100644 --- a/lib/PDF/Builder/Resource/XObject/Image/PNG.pm +++ b/lib/PDF/Builder/Resource/XObject/Image/PNG.pm @@ -5,8 +5,8 @@ use base 'PDF::Builder::Resource::XObject::Image'; use strict; use warnings; -our $VERSION = '3.025'; # VERSION -our $LAST_UPDATE = '3.024'; # manually update whenever code is changed +our $VERSION = '3.026'; # VERSION +our $LAST_UPDATE = '3.026'; # manually update whenever code is changed use Compress::Zlib; use POSIX qw(ceil floor); @@ -24,9 +24,11 @@ Inherits from L<PDF::Builder::Resource::XObject::Image> =head1 METHODS -=over +=head2 new + + $res = PDF::Builder::Resource::XObject::Image::PNG->new($pdf, $file, %opts) -=item $res = PDF::Builder::Resource::XObject::Image::PNG->new($pdf, $file, %opts) +=over Returns a PNG-image object. C<$pdf> is the PDF object being added to, C<$file> is the input PNG file, and the optional C<$name> of the new parent image object @@ -51,6 +53,9 @@ This is the name you can give for the PNG image object. The default is Pxnnnn. =back +Remember that you need to invoke the image_png method from Builder.pm in +order to use this functionality. + =back =head2 Supported PNG types @@ -385,9 +390,11 @@ sub new { return($self); } -=over +=head2 usesLib + + $mode = $png->usesLib() -=item $mode = $png->usesLib() +=over Returns 1 if Image::PNG::Libpng installed and used, 0 if not installed, or -1 if installed but not used (nouseIPL option given to C<image_png>). diff --git a/lib/PDF/Builder/Resource/XObject/Image/PNG_IPL.pm b/lib/PDF/Builder/Resource/XObject/Image/PNG_IPL.pm index 0070633..00f20d4 100644 --- a/lib/PDF/Builder/Resource/XObject/Image/PNG_IPL.pm +++ b/lib/PDF/Builder/Resource/XObject/Image/PNG_IPL.pm @@ -5,7 +5,7 @@ use base 'PDF::Builder::Resource::XObject::Image'; use strict; use warnings; -our $VERSION = '3.025'; # VERSION +our $VERSION = '3.026'; # VERSION our $LAST_UPDATE = '3.024'; # manually update whenever code is changed use Compress::Zlib; @@ -26,9 +26,11 @@ Inherits from L<PDF::Builder::Resource::XObject::Image> =head1 METHODS -=over +=head2 new + + $res = PDF::Builder::Resource::XObject::Image::PNG_IPL->new($pdf, $file, %opts) -=item $res = PDF::Builder::Resource::XObject::Image::PNG_IPL->new($pdf, $file, %opts) +=over Returns a PNG-image object. C<$pdf> is the PDF object being added to, C<$file> is the input PNG file, and the optional C<$name> of the new parent image object @@ -58,6 +60,8 @@ This is the name you can give for the PNG image object. The default is Pxnnnn. =back +Remember that you need to use Builder.pm's image_png to process PNG images. + =back =head2 Supported PNG types @@ -578,9 +582,11 @@ sub new { return($self); } -=over +=head2 usesLib + + $mode = $png->usesLib() -=item $mode = $png->usesLib() +=over Returns 1 if Image::PNG::Libpng installed and used, 0 if not installed, or -1 if installed but not used (nouseIPL option given to C<image_png>). diff --git a/lib/PDF/Builder/Resource/XObject/Image/PNM.pm b/lib/PDF/Builder/Resource/XObject/Image/PNM.pm index 87617c3..f36f10a 100644 --- a/lib/PDF/Builder/Resource/XObject/Image/PNM.pm +++ b/lib/PDF/Builder/Resource/XObject/Image/PNM.pm @@ -7,8 +7,8 @@ use base 'PDF::Builder::Resource::XObject::Image'; use strict; use warnings; -our $VERSION = '3.025'; # VERSION -our $LAST_UPDATE = '3.024'; # manually update whenever code is changed +our $VERSION = '3.026'; # VERSION +our $LAST_UPDATE = '3.026'; # manually update whenever code is changed use IO::File; use PDF::Builder::Util; @@ -24,9 +24,11 @@ PDF::Builder::Resource::XObject::Image::PNM - support routines for PNM (Portable =head2 METHODS -=over +=head2 new + + $res = PDF::Builder::Resource::XObject::Image::PNM->new($pdf, $file, %opts) -=item $res = PDF::Builder::Resource::XObject::Image::PNM->new($pdf, $file, %opts) +=over Options: @@ -59,6 +61,9 @@ color) may be anything from 1 to 65535 (the same maximum for all three colors), with 0 being full black. If the maximum sample value is 255 or smaller, three bytes of raw binary data per pixel, otherwise six bytes. +Remember that you need to use Builder.pm's image_pnm method to use this +functionality. + =cut # ------------------------------------------------------------------- diff --git a/lib/PDF/Builder/Resource/XObject/Image/TIFF.pm b/lib/PDF/Builder/Resource/XObject/Image/TIFF.pm index 3391b69..0e28d26 100644 --- a/lib/PDF/Builder/Resource/XObject/Image/TIFF.pm +++ b/lib/PDF/Builder/Resource/XObject/Image/TIFF.pm @@ -5,8 +5,8 @@ use base 'PDF::Builder::Resource::XObject::Image'; use strict; use warnings; -our $VERSION = '3.025'; # VERSION -our $LAST_UPDATE = '3.024'; # manually update whenever code is changed +our $VERSION = '3.026'; # VERSION +our $LAST_UPDATE = '3.026'; # manually update whenever code is changed use Compress::Zlib; @@ -21,9 +21,11 @@ PDF::Builder::Resource::XObject::Image::TIFF - TIFF image support =head1 METHODS -=over +=head2 new + + $res = PDF::Builder::Resource::XObject::Image::TIFF->new($pdf, $file, %opts) -=item $res = PDF::Builder::Resource::XObject::Image::TIFF->new($pdf, $file, %opts) +=over Returns a TIFF-image object. @@ -41,6 +43,11 @@ This is the name you can give for the TIFF image object. The default is Ixnnnn. =back +Remember that you need to use the Builder.pm method image_tiff in order to +display a TIFF file. + +=back + =cut sub new { @@ -89,7 +96,11 @@ sub new { return $self; } -=item $mode = $tif->usesLib() +=head2 usesLib + + $mode = $tif->usesLib() + +=over Returns 1 if Graphics::TIFF installed and used, 0 if not installed, or -1 if installed but not used (nouseGT option given to C<image_tiff>). @@ -100,6 +111,8 @@ advance of actually using it, in case you want to use some functionality available only in TIFF_GT. See the <PDF::Builder> LA_GT() call if you need to know in advance. +=back + =cut sub usesLib { @@ -313,7 +326,11 @@ sub read_tiff { return $self; } -=item $value = $tif->tiffTag($tag) +=head2 tiffTag + + $value = $tif->tiffTag($tag) + +=over returns the value of the internal tiff-tag. @@ -323,6 +340,8 @@ B<Useful Tags:> xRes, yRes (dpi; pixel/cm if resUnit==3) resUnit +=back + =cut sub tiffTag { @@ -330,8 +349,4 @@ sub tiffTag { return $self->{' tiff'}->{$tag}; } -=back - -=cut - 1; diff --git a/lib/PDF/Builder/Resource/XObject/Image/TIFF/File.pm b/lib/PDF/Builder/Resource/XObject/Image/TIFF/File.pm index c94aaab..37f960e 100644 --- a/lib/PDF/Builder/Resource/XObject/Image/TIFF/File.pm +++ b/lib/PDF/Builder/Resource/XObject/Image/TIFF/File.pm @@ -3,8 +3,8 @@ package PDF::Builder::Resource::XObject::Image::TIFF::File; use strict; use warnings; -our $VERSION = '3.025'; # VERSION -our $LAST_UPDATE = '3.023'; # manually update whenever code is changed +our $VERSION = '3.026'; # VERSION +our $LAST_UPDATE = '3.026'; # manually update whenever code is changed use IO::File; @@ -12,6 +12,19 @@ use IO::File; PDF::Builder::Resource::XObject::Image::TIFF::File - support routines for TIFF image library +=head1 METHODS + +=head2 new + + PDF::Builder::Resource::XObject::Image::TIFF::File->new() + +=over + +Create a TIFF image object, I<not> using the Graphics::TIFF library. +Remember to use the Builder.pm method image_tiff. + +=back + =cut sub new { diff --git a/lib/PDF/Builder/Resource/XObject/Image/TIFF/File_GT.pm b/lib/PDF/Builder/Resource/XObject/Image/TIFF/File_GT.pm index 8c15d8d..985c384 100644 --- a/lib/PDF/Builder/Resource/XObject/Image/TIFF/File_GT.pm +++ b/lib/PDF/Builder/Resource/XObject/Image/TIFF/File_GT.pm @@ -3,8 +3,8 @@ package PDF::Builder::Resource::XObject::Image::TIFF::File_GT; use strict; use warnings; -our $VERSION = '3.025'; # VERSION -our $LAST_UPDATE = '3.023'; # manually update whenever code is changed +our $VERSION = '3.026'; # VERSION +our $LAST_UPDATE = '3.026'; # manually update whenever code is changed use IO::File; use Graphics::TIFF ':all'; # already confirmed to be installed @@ -13,6 +13,19 @@ use Graphics::TIFF ':all'; # already confirmed to be installed PDF::Builder::Resource::XObject::Image::TIFF::File_GT - support routines for TIFF image library (Graphics::TIFF enabled) +=head1 METHODS + +=head2 new + + PDF::Builder::Resource::XObject::Image::TIFF::File_GT->new() + +=over + +Create an image object from TIFF input, using the Graphics::TIFF library. +Remember to use the Builder.pm method image_tiff for this functionality. + +=back + =cut sub new { diff --git a/lib/PDF/Builder/Resource/XObject/Image/TIFF_GT.pm b/lib/PDF/Builder/Resource/XObject/Image/TIFF_GT.pm index b3b8e46..c2c91e7 100644 --- a/lib/PDF/Builder/Resource/XObject/Image/TIFF_GT.pm +++ b/lib/PDF/Builder/Resource/XObject/Image/TIFF_GT.pm @@ -5,8 +5,8 @@ use base 'PDF::Builder::Resource::XObject::Image'; use strict; use warnings; -our $VERSION = '3.025'; # VERSION -our $LAST_UPDATE = '3.024'; # manually update whenever code is changed +our $VERSION = '3.026'; # VERSION +our $LAST_UPDATE = '3.026'; # manually update whenever code is changed use Compress::Zlib; @@ -23,9 +23,11 @@ PDF::Builder::Resource::XObject::Image::TIFF_GT - TIFF image support =head1 METHODS -=over +=head2 new + + $res = PDF::Builder::Resource::XObject::Image::TIFF_GT->new($pdf, $file, %opts) -=item $res = PDF::Builder::Resource::XObject::Image::TIFF_GT->new($pdf, $file, %opts) +=over Returns a TIFF-image object. C<$pdf> is the PDF object being added to, C<$file> is the input TIFF file, and the optional C<$name> of the new parent image object @@ -69,6 +71,8 @@ look into adding it as an option. According to Graphic::TIFF's owner (ticket RT 133955), this is coming directly from libtiff (as write to STDERR), so he can't do anything about it! +=back + =cut sub new { @@ -137,7 +141,11 @@ sub new { return $self; } # end of new() -=item $mode = $tif->usesLib() +=head2 usesLib + + $mode = $tif->usesLib() + +=over Returns 1 if Graphics::TIFF installed and used, 0 if not installed, or -1 if installed but not used (nouseGT option given to C<image_tiff>). |