diff options
author | Karl Berry <karl@freefriends.org> | 2010-09-18 00:07:10 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-09-18 00:07:10 +0000 |
commit | abb06c39927dee255284ee41af720b3f53d23dd6 (patch) | |
tree | da5f82c9d224380288767ece7eff23bbc6f0c521 | |
parent | 125d2ca404411b7498a632a2c5b5f7e49bf3a321 (diff) |
pdfcrop update (17sep10)
git-svn-id: svn://tug.org/texlive/trunk@19781 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/support/pdfcrop/README | 10 | ||||
-rwxr-xr-x | Master/texmf-dist/scripts/pdfcrop/pdfcrop.pl | 59 |
2 files changed, 51 insertions, 18 deletions
diff --git a/Master/texmf-dist/doc/support/pdfcrop/README b/Master/texmf-dist/doc/support/pdfcrop/README index b3250ad96b0..0ce9b3f6ccb 100644 --- a/Master/texmf-dist/doc/support/pdfcrop/README +++ b/Master/texmf-dist/doc/support/pdfcrop/README @@ -1,4 +1,4 @@ -README for pdfcrop 2010/09/15 v1.30 +README for pdfcrop 2010/09/17 v1.31 TABLE OF CONTENTS ================= @@ -230,10 +230,14 @@ L. HISTORY is not found via PATH. * Windows only: support of spaces in command names in unrestricted mode. -2010/09/06 v1.29: * Find the latest Ghostscript version in registry. +2010/09/06 v1.29: * Find the latest Ghostscript version in registry. 2010/09/15 v1.30: * Warning of pdfTeX because of \pdfobjcompresslevel avoided when reducing \pdfminorversion. - * Fix for TeX syntax characters in input file names. + * Fix for TeX syntax characters in input file names. +2010/09/17 v1.31: * Passing the input file name via hex string to TeX. + * Again input file names restricted for Ghostscript + command line, switch then to symbol link/copy + method. M. TODO ======= diff --git a/Master/texmf-dist/scripts/pdfcrop/pdfcrop.pl b/Master/texmf-dist/scripts/pdfcrop/pdfcrop.pl index 1fdd3ab3d8f..5e43ec024fd 100755 --- a/Master/texmf-dist/scripts/pdfcrop/pdfcrop.pl +++ b/Master/texmf-dist/scripts/pdfcrop/pdfcrop.pl @@ -21,8 +21,8 @@ $^W=1; # turn warning on # my $file = "pdfcrop.pl"; my $program = uc($&) if $file =~ /^\w+/; -my $version = "1.30"; -my $date = "2010/09/15"; +my $version = "1.31"; +my $date = "2010/09/17"; my $author = "Heiko Oberdiek"; my $copyright = "Copyright (c) 2002-2010 by $author."; # @@ -91,6 +91,10 @@ my $copyright = "Copyright (c) 2002-2010 by $author."; # 2010/09/15 v1.30: * Warning of pdfTeX because of \pdfobjcompresslevel # avoided when reducing \pdfminorversion. # * Fix for TeX syntax characters in input file names. +# 2010/09/17 v1.31: * Passing the input file name via hex string to TeX. +# * Again input file names restricted for Ghostscript +# command line, switch then to symbol link/copy +# method. ### program identification my $title = "$program $version, $date - $copyright\n"; @@ -602,9 +606,9 @@ $SIG{'__DIE__'} = \&clean; ### Calculation of BoundingBoxes # use safe file name for use within cmd line of gs (unknown shell: space, ...) -# and pdfTeX (hash, curly braces, ...) +# and XeTeX (hash, curly braces, ...) my $inputfilesafe = $inputfile; -if ($inputfile =~ /[\s\$~'"#{}]/) { +if (not $inputfile =~ /^[\w\d\.\-\:\/@]+$/) { # /[\s\$~'"#{}%]/ $inputfilesafe = "$tmp-img.pdf"; push @unlink_files, $inputfilesafe; my $symlink_exists = eval { symlink("", ""); 1 }; @@ -657,18 +661,51 @@ print TMP <<'END_TMP'; \catcode60 12 % less \catcode61 12 % equals \catcode62 12 % greater +\catcode64 12 % at \catcode91 12 % left square \catcode93 12 % right square \catcode96 12 % back tick \catcode123 1 % left curly brace \catcode125 2 % right curly brace +\catcode126 12 % tilde \catcode`\#=6 % \escapechar=92 % +\def\IfUndefined#1#2#3{% + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname#1\endcsname\relax + #2% + \else + #3% + \fi +} END_TMP -print TMP "\\def\\pdffile{$inputfilesafe}\n"; +my $pdffilehex = unpack 'H*', $inputfilesafe; +$pdffilehex = "\U$pdffilehex\E"; +print TMP "\\def\\pdffilehex{$pdffilehex}\n"; print TMP <<'END_TMP'; -\def\stripprefix#1>{} -\edef\pdffile{\expandafter\stripprefix\meaning\pdffile}% +\IfUndefined{pdfunescapehex}{% + \begingroup + \gdef\pdffile{}% + \def\do#1#2{% + \ifx\relax#2\relax + \ifx\relax#1\relax + \else + \errmessage{Invalid hex string, should not happen!}% + \fi + \else + \lccode`0="#1#2\relax + \lowercase{% + \xdef\pdffile{\pdffile0}% + }% + \expandafter\do + \fi + }% + \expandafter\do\pdffilehex\relax\relax + \endgroup +}{% + \edef\pdffile{\pdfunescapehex{\pdffilehex}}% +} +\immediate\write-1{Input file: \pdffile} END_TMP if ($::opt_tex eq 'luatex') { print TMP <<'END_TMP'; @@ -729,14 +766,6 @@ if ($::opt_tex eq 'pdftex' or $::opt_tex eq 'luatex') { \pdfoutput=1 % \pdfcompresslevel=9 % \csname pdfmapfile\endcsname{} -\def\IfUndefined#1#2#3{% - \begingroup\expandafter\expandafter\expandafter\endgroup - \expandafter\ifx\csname#1\endcsname\relax - #2% - \else - #3% - \fi -} \def\setpdfversion#1{% \IfUndefined{pdfobjcompresslevel}{% }{% |