Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

PDF::Reuse and pdflatex

by atend (Acolyte)
on Jan 23, 2013 at 13:52 UTC ( #1014906=perlquestion: print w/replies, xml ) Need Help??
atend has asked for the wisdom of the Perl Monks concerning the following question:


It seems .pdf-files produced with pdflatex (TeX Live 2012) cannot be used directly by PDF::Reuse (v. 0.35) (at least not by me).

#!/usr/bin/env perl use strict; use warnings; use PDF::Reuse; open my $fh, '>', 'file.tex' or die $!; print $fh ' \documentclass{article} \begin{document} Nothing to see here. \end{document} ', "\n"; system "pdflatex file.tex"; prFile( 'result.pdf' ); prDoc( 'file.pdf' ); prEnd();

This gives:

An error occurred at ./ line 18 Didn't find pages More information might be found in error.log at ./ line 18

error.log contains:

Didn't find pages The error occurred when executing: at blib/lib/PDF/ (autosplit into blib/lib/auto/PDF/Reuse/anal line 5929 PDF::Reuse::analysera('file.pdf', 1, '') called at blib/lib/PDF/Re (autosplit into blib/lib/auto/PDF/Reuse/ line 3562 PDF::Reuse::prDoc('file.pdf') called at ./ line 18 Situation when the error occurred Bytes written to the current pdf-file, pos = 15 Object processed, not necessarily written objNr = 3 Current pdf-file, utfil = result.pdf File logging the run, runfil = undef Local time = Wed Jan 23 14:38 +:59 2013

Anyone have any advice, or a possible fix for this?

Replies are listed 'Best First'.
Re: PDF::Reuse and pdflatex
by marto (Bishop) on Jan 23, 2013 at 14:29 UTC

    What version of PDF is produced by this software? PDF::Reuse states that it's compatible with v1.4 and some of v1.5.

      It is 1.5, so that's probably the problem. If I go .dvi -> .ps -> .pdf with dvips and pstopdf I get a v. 1.3 pdf-file, but that introduces other problems (not perl related)... *sigh*

      Thanks for the reply.

Re: PDF::Reuse and pdflatex
by atend (Acolyte) on Jan 23, 2013 at 15:31 UTC

    Solved it.
    Including "\pdfminorversion=4" in the latex preamble outputs pdf v. 1.4, which works perfecly.
    Thanks for the replies.

      Atend, what do you mean by 'Including "\pdfminorversion=4" in the latex preamble outputs pdf v. 1.4,'? can you please share some sample? Thanks.
Re: PDF::Reuse and pdflatex
by pvaldes (Chaplain) on Jan 23, 2013 at 14:33 UTC
    Your code works perfectly for me... (reuse 0.35-2). I have a void, but otherwise correct, result.pdf and a correct file.pdf

      What version of pdflatex do you have? Mine is pdfTeX 3.1415926-2.4-1.40.13.
      Perhaps grabbing an older version would do the trick.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1014906]
Approved by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2017-05-24 01:35 GMT
Find Nodes?
    Voting Booth?