diff options
author | Karl Berry <karl@freefriends.org> | 2010-01-10 01:05:40 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-01-10 01:05:40 +0000 |
commit | 0257641352e7f3139f754e7af6e99b0b95b9059f (patch) | |
tree | 071f2cd614038785084e278cf8c0d6b5dcc153cd | |
parent | edb3f0e6434fdd9b9ba2f6abaef04d9a3ada23d7 (diff) |
pdfcrop update (9jan10)
git-svn-id: svn://tug.org/texlive/trunk@16655 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/support/pdfcrop/README | 5 | ||||
-rwxr-xr-x | Master/texmf-dist/scripts/pdfcrop/pdfcrop.pl | 76 | ||||
-rwxr-xr-x | Master/tlpkg/libexec/ctan2tds | 1 |
3 files changed, 74 insertions, 8 deletions
diff --git a/Master/texmf-dist/doc/support/pdfcrop/README b/Master/texmf-dist/doc/support/pdfcrop/README index 1ddb1f6211b..4ca6ffeb320 100644 --- a/Master/texmf-dist/doc/support/pdfcrop/README +++ b/Master/texmf-dist/doc/support/pdfcrop/README @@ -1,4 +1,4 @@ -README for pdfcrop 2009/12/29 v1.22 +README for pdfcrop 2010/01/09 v1.23 TABLE OF CONTENTS ================= @@ -24,7 +24,7 @@ PDF file with removed margins. B. COPYRIGHT, DISCLAIMER, LICENSE ================================= -Copyright (C) 2002, 2004, 2005, 2008, 2009 Heiko Oberdiek. +Copyright (C) 2002, 2004, 2005, 2008-2010 Heiko Oberdiek. This program may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.2 @@ -203,6 +203,7 @@ L. HISTORY * Option --luatex and --luatexcmd added for LuaTeX. 2009/12/29 v1.22: * Syntax description for option --bbox fixed (Lukas Prochazka). +2010/01/09 v1.23: * Options --bbox-odd and --bbox-even added. M. TODO ======= diff --git a/Master/texmf-dist/scripts/pdfcrop/pdfcrop.pl b/Master/texmf-dist/scripts/pdfcrop/pdfcrop.pl index 16ff326b71d..5855eb0849e 100755 --- a/Master/texmf-dist/scripts/pdfcrop/pdfcrop.pl +++ b/Master/texmf-dist/scripts/pdfcrop/pdfcrop.pl @@ -5,7 +5,7 @@ $^W=1; # turn warning on # # pdfcrop.pl # -# Copyright (C) 2002, 2004, 2005, 2008, 2009 Heiko Oberdiek. +# Copyright (C) 2002, 2004, 2005, 2008-2010 Heiko Oberdiek. # # This program may be distributed and/or modified under the # conditions of the LaTeX Project Public License, either version 1.2 @@ -22,10 +22,10 @@ $^W=1; # turn warning on # my $file = "pdfcrop.pl"; my $program = uc($&) if $file =~ /^\w+/; -my $version = "1.22"; -my $date = "2009/12/29"; +my $version = "1.23"; +my $date = "2010/01/09"; my $author = "Heiko Oberdiek"; -my $copyright = "Copyright (c) 2002-2009 by $author."; +my $copyright = "Copyright (c) 2002-2010 by $author."; # # Reqirements: Perl5, Ghostscript # History: @@ -68,6 +68,7 @@ my $copyright = "Copyright (c) 2002-2009 by $author."; # * Option --luatex and --luatexcmd added for LuaTeX. # 2009/12/29 v1.22: * Syntax description for option --bbox fixed # (Lukas Prochazka). +# 2010/01/09 v1.23: * Options --bbox-odd and -bbox-even added. ### program identification my $title = "$program $version, $date - $copyright\n"; @@ -187,6 +188,8 @@ $::opt_hires = 0; $::opt_papersize = ""; $::opt_resolution = ""; $::opt_bbox = ""; +$::opt_bbox_odd = ""; +$::opt_bbox_even = ""; $::opt_initex = 0; sub usage ($) { @@ -225,6 +228,8 @@ Expert options: --bbox "<left> <bottom> <right> <top>" () override bounding box found by ghostscript with origin at the lower left corner + --bbox-odd, --bbox-even () + Same as --bbox, but for odd, even pages only Examples: \L$program\E --margins 10 input.pdf output.pdf \L$program\E --margins '5 10 5 20' --clip input.pdf output.pdf @@ -264,6 +269,8 @@ GetOptions( "papersize=s", "resolution=s", "bbox=s", + "bbox-odd=s" => \$::opt_bbox_odd, + "bbox-even=s" => \$::opt_bbox_even, "restricted" => sub { $restricted = 1; }, ) or usage(1); !$::opt_help or usage(0); @@ -292,6 +299,30 @@ if ($::opt_bbox) { die "$Error Parse error (option --bbox \"$::opt_bbox\")!\n"; } } +if ($::opt_bbox_odd) { + $::opt_bbox_odd =~ s/^\s+//; + $::opt_bbox_odd =~ s/\s+$//; + $::opt_bbox_odd =~ s/\s+/ /; + if ($::opt_bbox_odd =~ /^-?\d*\.?\d+ -?\d*\.?\d+ -?\d*\.?\d+ -?\d*\.?\d+$/) { + print "* Explicite Bounding Box for odd pages: $::opt_bbox_odd\n" + if $::opt_debug; + } + else { + die "$Error Parse error (option --bbox-odd \"$::opt_bbox_odd\")!\n"; + } +} +if ($::opt_bbox_even) { + $::opt_bbox_even =~ s/^\s+//; + $::opt_bbox_even =~ s/\s+$//; + $::opt_bbox_even =~ s/\s+/ /; + if ($::opt_bbox_even =~ /^-?\d*\.?\d+ -?\d*\.?\d+ -?\d*\.?\d+ -?\d*\.?\d+$/) { + print "* Explicite Bounding Box for even pages: $::opt_bbox_even\n" + if $::opt_debug; + } + else { + die "$Error Parse error (option --bbox-even \"$::opt_bbox_even\")!\n"; + } +} @ARGV <= 2 or die "$Error Too many files!\n"; @@ -620,9 +651,42 @@ print "* Running ghostscript for BoundingBox calculation ...\n" print "* Ghostscript call: $::opt_gscmd @gsargs\n" if $::opt_debug; my @bbox; +my @bbox_all; +my @bbox_odd; +my @bbox_even; if ($::opt_bbox) { $::opt_bbox =~ /([-\d\.]+) ([-\d\.]+) ([-\d\.]+) ([-\d\.]+)/; - @bbox = ($1, $2, $3, $4); + @bbox_all = ($1, $2, $3, $4); +} +if ($::opt_bbox_odd) { + $::opt_bbox_odd =~ /([-\d\.]+) ([-\d\.]+) ([-\d\.]+) ([-\d\.]+)/; + @bbox_odd = ($1, $2, $3, $4); +} +if ($::opt_bbox_even) { + $::opt_bbox_even =~ /([-\d\.]+) ([-\d\.]+) ([-\d\.]+) ([-\d\.]+)/; + @bbox_even = ($1, $2, $3, $4); +} + +sub getbbox ($$$$$) { + my $page = shift; + my $a = shift; + my $b = shift; + my $c = shift; + my $d = shift; + if ($page % 2 == 1) { + if ($::opt_bbox_odd) { + return @bbox_odd; + } + } + else { + if ($::opt_bbox_even) { + return @bbox_even; + } + } + if ($::opt_bbox) { + return @bbox_all; + } + return ($a, $b, $c, $d); } my $page = 0; my $gs_pipe = "$::opt_gscmd -dSAFER @gsargs 2>&1"; @@ -636,8 +700,8 @@ while (<GS>) { print $_ if $::opt_verbose; next unless /^$bb:\s*(-?[\.\d]+) (-?[\.\d]+) (-?[\.\d]+) (-?[\.\d]+)/o; - @bbox = ($1, $2, $3, $4) unless $::opt_bbox; $page++; + @bbox = getbbox($page, $1, $2, $3, $4); my $empty = 0; $empty = 1 if $bbox[0] >= $bbox[2]; diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index 8ed38102e2f..05a38886bde 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -535,6 +535,7 @@ $Master = "$mydir/../.."; 'pstricks-add',"&MAKEpst", 'pxfonts', "&MAKEflatten", 'ragged2e', "die 'skipping, part of ms'", + 'rake4latex', "die 'skipping, requires rake4latex'", 'realcalc', "die 'skipping, nosell license'", 'references', "die 'skipping, requires binary'", 'refstyle', "&MAKEcopy", |