Skip Menu |

This queue is for tickets about the PDF-CreateSimple CPAN distribution.

Report information
The Basics
Id: 21930
Status: new
Priority: 0/
Queue: PDF-CreateSimple

People
Owner: Nobody in particular
Requestors: timw [...] ccbill.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: bug when working with infiles
Date: Thu, 5 Oct 2006 17:13:49 -0700
To: <bug-PDF-CreateSimple [...] rt.cpan.org>
From: "Tim White" <timw [...] ccbill.com>
Disb name/version: PDF-CreateSimple1.0.2.1 perl/OS: This is perl, v5.8.7 built for x86_64-linux This module incorrectly tracks the page index when loading a PDF infile that consists of multiple pages: #load some multi-page PDF my $pdf = PDF::CreateSimple->new('newFoo.pdf', 'oldFoo.pdf', 'Letter'); $pdf->addNewPage(); drawImage('foo.jpg'); New images always appear on page 2, whereas they should appear at the end. The new() constructor doesn't track the # of pages of the infile, but this can be fixed by modifying new() of CreateSimple.pm at line 23: sub new{ my ($class,$filePath,$templateFile,$firstPageFormat) = @_; my $self = {}; $self = bless($self, $class); my $PDF; $self->{'_page_images'} = [[]]; if ($templateFile){ $PDF = PDF::API2->open($templateFile); ### fix by Tim White for my $i (0.. ($PDF->pages-2)){ push (@{$self->{'_page_images'}}, []); } ### } Thanks, Tim White ccbill.com
Subject: RE: [rt.cpan.org #21930] Related bug with importPage()
Date: Fri, 6 Oct 2006 12:33:27 -0700
To: <bug-PDF-CreateSimple [...] rt.cpan.org>
From: "Tim White" <timw [...] ccbill.com>
Related bug with importPage(): when importing a pdf page, the page images array is not updated, thus attempting to append and draw new images overwrites on previous pages. Here's the fix for CreateSimple.pm at line 842: sub importPage{ my ($self,$sourcepdfPath,$sourceindex,$pageNo) = @_; my $PDF = $self->getPDF; throw Error::Simple('Page Number is invalid') if $pageNo > $PDF->pages || $pageNo < 0; my $sourcePDF = PDF::API2->open($sourcepdfPath); throw Error::Simple('Wrong source page number') if $sourceindex > $sourcePDF->pages || $sourceindex < 0; $PDF->importpage($sourcePDF, $sourceindex, $pageNo); ### fix by Tim White push (@{$self->{'_page_images'}}, []); ### $self->_setCurPage($pageNo); $sourcePDF->end; } Show quoted text
-----Original Message----- From: Bugs in PDF-CreateSimple via RT [mailto:bug-PDF-CreateSimple@rt.cpan.org] Sent: Thursday, October 05, 2006 5:14 PM To: Tim White Subject: [rt.cpan.org #21930] AutoReply: bug when working with infiles Greetings, This message has been automatically generated in response to the creation of a trouble ticket regarding: "bug when working with infiles", a summary of which appears below. There is no need to reply to this message right now. Your ticket has been assigned an ID of [rt.cpan.org #21930]. Your ticket is accessible on the web at: http://rt.cpan.org/Ticket/Display.html?id=21930 Please include the string: [rt.cpan.org #21930] in the subject line of all future correspondence about this issue. To do so, you may reply to this message. Thank you, bug-PDF-CreateSimple@rt.cpan.org ------------------------------------------------------------------------ - Disb name/version: PDF-CreateSimple1.0.2.1 perl/OS: This is perl, v5.8.7 built for x86_64-linux This module incorrectly tracks the page index when loading a PDF infile that consists of multiple pages: #load some multi-page PDF my $pdf = PDF::CreateSimple->new('newFoo.pdf', 'oldFoo.pdf', 'Letter'); $pdf->addNewPage(); drawImage('foo.jpg'); New images always appear on page 2, whereas they should appear at the end. The new() constructor doesn't track the # of pages of the infile, but this can be fixed by modifying new() of CreateSimple.pm at line 23: sub new{ my ($class,$filePath,$templateFile,$firstPageFormat) = @_; my $self = {}; $self = bless($self, $class); my $PDF; $self->{'_page_images'} = [[]]; if ($templateFile){ $PDF = PDF::API2->open($templateFile); ### fix by Tim White for my $i (0.. ($PDF->pages-2)){ push (@{$self->{'_page_images'}}, []); } ### } Thanks, Tim White ccbill.com