Jef
unread,Jul 14, 2010, 9:32:29 AM7/14/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to PDF-Reuse
Took me some time to figure out this bug :
With PDF::Reuse, you cannot re-use filenames, unless you use the trick
below.
My application work like this :
foreach my $repor (@reports) {
foreach my $page (@pages) {
prFile("page-".$cnt.".pdf);
### create page with PDF::Reuse
prEnd();
$cnt++;
}
prFile("report-".$report.".pdf);
for ($i=0; $i<$cnt; $i++) {
prDoc("page-".$i.".pdf");
}
prEnd();
for ($i=0; $i<$cnt; $i++) {
unlink("page-".$i.".pdf");
}
}
The problem is that as soon as I try to prDoc("page-0.pdf") for the
second time, I get "Didn't find pages " error message).
The cause is that PDF::Reuse is not re-entrant and (wrongly) assumes
that a file already processed will have the same content if re-
processed.
The solution I found is to add this piece of code after the unlinking
of all temporary PDF :
%PDF::Reuse::processed=();
Not elegant, but it works for now.
Two questions for Lars :
- is this the right thing to do ? (there may be some other variables
to re-initialize)
- can this be fixed in the code, or is this a design decision (in
order to avoid extra re-processing, I guess) ?
J-F