Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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:

Hello,

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 ./pdfperl.pl line 18 Didn't find pages More information might be found in error.log at ./pdfperl.pl line 18

error.log contains:

Didn't find pages The error occurred when executing: at blib/lib/PDF/Reuse.pm (autosplit into blib/lib/auto/PDF/Reuse/anal +ysera.al) line 5929 PDF::Reuse::analysera('file.pdf', 1, '') called at blib/lib/PDF/Re +use.pm (autosplit into blib/lib/auto/PDF/Reuse/prDoc.al) line 3562 PDF::Reuse::prDoc('file.pdf') called at ./pdfperl.pl 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?

Comment on PDF::Reuse and pdflatex
Select or Download Code
Re: PDF::Reuse and pdflatex
by marto (Chancellor) 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 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.

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1014906]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2014-09-17 02:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (56 votes), past polls