Skip Menu |

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

Report information
The Basics
Id: 123075
Status: resolved
Priority: 0/
Queue: PDF-Create

People
Owner: MANWAR [...] cpan.org
Requestors: rob [...] lavoco.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.42
Fixed in: 1.43



Subject: close vs flush
Date: Tue, 19 Sep 2017 21:19:06 +0100
To: bug-PDF-Create [...] rt.cpan.org
From: Robert Brown <rob [...] lavoco.com>
Hi, Since upgrading to 1.42 from 1.41 (just as part of a server migration) we noticed images no longer appearing in the finished PDF, and acrobat reader didn't like opening them. We were previously just calling close() when we were finished adding content. From the changes file it looks like you did something around this, but actually ended up breaking our code. I've reverted to 1.41 for the time being since that at least works (still) with our code. What should we call when we've finished creating the PDF? the docs aren't too clear on the diff between close() and flush(), and had me reading the code, which is always a bad sign ;) Cheers, Rob
Hi Rob, Apology for the inconvenience. Can you please provide script that can re-produce the issue you are having? It would help me investigate the matter quickly. Many Thanks. Best Regards, Mohammad S Anwar
Subject: Re: [rt.cpan.org #123075] close vs flush
Date: Wed, 20 Sep 2017 10:47:49 +0100
To: bug-PDF-Create [...] rt.cpan.org
From: Robert Brown <rob [...] lavoco.com>
Hi Mohammad, Here's how our code was originally written, it's a Moose module btw, with the $self->pdf() attribute holding the PDF::Create object. The bit at the bottom with the image and closing the pdf was where the problem was occurring. As I say, the docs weren't too clear, and when I looked at the code, I was half expecting close() to call flush(), or vice-verse, but I didn't see that, so just reverted to 1.41 for now. =head2 create_ticket Creates PDF file with job ticket. =cut sub create_ticket { my $self = shift; $self->pdf( PDF::Create->new( 'filename' => $self->path, 'Author' => 'John Doe', 'Title' => 'Sample PDF', 'CreationDate' => [ localtime ], ) ); # add a Letter sized page $self->page( $self->pdf->new_page('MediaBox' => $self->pdf->get_page_size('Letter')) ); # Prepare a font $self->font_normal( $self->pdf->font('BaseFont' => 'Helvetica') ); $self->font_bold( $self->pdf->font('BaseFont' => 'Helvetica-Bold') ); $self->current_font($self->font_normal); $self->page->string( $self->font_bold, 16, 421, 741, "#PrintIsGood"); $self->page->string( $self->font_bold, $self->font_size, $self->line_begin, 681, "NOTICE OF ORDER:"); $self->page->string( $self->font_normal, $self->font_size, $self->line_begin, 660, "Payment Details"); $self->x($self->line_begin); $self->y(626.5); $self->_println( "Order Number: " . $self->order->order_number ); $self->_println( "Payment Date: " . $self->payment_date ); $self->_println( "Buyer: " . $self->order->first_name . " " . $self->order->last_name ); * ** my $jpg = $self->pdf->image($self->thumbnail);** ** $self->page->image( 'image' => $jpg, 'xscale' => 0.55, 'yscale' => 0.55, 'xpos' => 320, 'ypos' => 550 );** ** ** # Close the file and write the PDF** ** $self->pdf->close;* return $self->path; } On 20/09/17 10:19, Mohammad Sajid Anwar via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=123075 > > > Hi Rob, > > Apology for the inconvenience. > Can you please provide script that can re-produce the issue you are having? > > It would help me investigate the matter quickly. > > Many Thanks. > Best Regards, > Mohammad S Anwar
Hi Rob, Please try the attached tar ball and let me know if this fix the issue. Best Regards, Mohammad S Anwar
Subject: PDF-Create-1.42.tar.gz
Download PDF-Create-1.42.tar.gz
application/x-gzip 118.1k

Message body not shown because it is not plain text.

Released the patch PDF::Create v1.43