diff options
author | Karl Berry <karl@freefriends.org> | 2008-04-10 00:04:30 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-04-10 00:04:30 +0000 |
commit | 746495bc89836f195951c403990bc5a54e0cc187 (patch) | |
tree | f5752077bea32f1addfc8dde3e9c2ad0e8ce466c | |
parent | d1adbe679a00856057b13139dbb9bc678ff74dd5 (diff) |
pdfcrop 1.9 (7apr08), and switch to ctan2tl updating
git-svn-id: svn://tug.org/texlive/trunk@7371 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Build/source/texk/tetex/Makefile.in | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/pdfcrop/README | 147 | ||||
-rw-r--r--[-rwxr-xr-x] | Master/texmf-dist/scripts/pdfcrop/pdfcrop.pl (renamed from Master/texmf/scripts/pdfcrop/pdfcrop.pl) | 43 | ||||
-rwxr-xr-x | Master/tlpkg/bin/ctan2tds | 3 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpkg-ctan-check | 1 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/bin-pdftools.tlpsrc | 3 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/collection-binextra.tlpsrc | 1 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/pdfcrop.tlpsrc | 4 |
8 files changed, 193 insertions, 11 deletions
diff --git a/Build/source/texk/tetex/Makefile.in b/Build/source/texk/tetex/Makefile.in index c7db674eea8..0637ec5e8bd 100644 --- a/Build/source/texk/tetex/Makefile.in +++ b/Build/source/texk/tetex/Makefile.in @@ -20,7 +20,6 @@ LINKSUFFIX = LINKED_SCRIPTS = \ texmf/scripts/a2ping/a2ping.pl \ texmf/scripts/epstopdf/epstopdf.pl \ - texmf/scripts/pdfcrop/pdfcrop.pl \ texmf/scripts/pkfix/pkfix.pl \ texmf/scripts/ps2eps/ps2eps.pl \ texmf/scripts/tetex/e2pall.pl \ @@ -31,6 +30,7 @@ LINKED_SCRIPTS = \ texmf-dist/scripts/glossaries/makeglossaries \ texmf-dist/scripts/mkjobtexmf/mkjobtexmf.pl \ texmf-dist/scripts/perltex/perltex.pl \ + texmf-dist/scripts/pdfcrop/pdfcrop.pl \ texmf-dist/scripts/texcount/TeXcount.pl \ texmf-dist/scripts/thumbpdf/thumbpdf.pl \ texmf-dist/scripts/ppower4/ppower4.texlua \ diff --git a/Master/texmf-dist/doc/generic/pdfcrop/README b/Master/texmf-dist/doc/generic/pdfcrop/README new file mode 100644 index 00000000000..19d55cdcd5a --- /dev/null +++ b/Master/texmf-dist/doc/generic/pdfcrop/README @@ -0,0 +1,147 @@ +README for pdfcrop 2008/04/05 v1.9 + +TABLE OF CONTENTS +================= +A. Description +B. Copyright, Disclaimer, License +C. Files +D. Requirements +E. Installation +F. User Interface +G. Author +H. Acknowledgement +I. Questions, Suggested Improvements +J. Known Problems +K. History +L. ToDo + +A. DESCRIPTION +============== +PDFCROP takes a PDF file as input, calculates the BoundingBox +for each page by the help of ghostscript and generates a output +PDF file with removed margins. + +B. COPYRIGHT, DISCLAIMER, LICENSE +================================= +Copyright (C) 2002, 2004, 2005, 2008 Heiko Oberdiek. + +This program may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either version 1.2 +of this license or (at your option) any later version. +The latest version of this license is in + http://www.latex-project.org/lppl.txt +and version 1.2 or later is part of all distributions of LaTeX +version 1999/12/01 or later. + +C. FILES +======== +The project `pdfcrop' consists of two files: +pdfcrop.pl: This perl script is the main program. The extension + `.pl' may be omitted. +README: Documentation, the file you are reading. + +Following temporary files are produced if `pdfcrop' is invoked: +tmp-pdfcrop-*.tex: input file for pdfTeX +tmp-pdfcrop-*.log: log file of pdfTeX run +tmp-pdfcrop-*.pdf: result after pdfTeX run + +D. REQUIREMENTS +=============== +* Perl5 (version 5 of the perl interpreter) +* Ghostscript (>= 8.0 if PDF file contains rotated pages) +* pdfTeX, version >= 1.0 (because of page selecting and \pdfximage syntax) + +E. INSTALLATION +=============== + +1. Perl script `pdfcrop.pl': + + TDS 1.1 location: + * texmf/scripts/pdfcrop/pdfcrop.pl + * and a directory that is part of PATH contains a wrapper script + or link with name "pdfcrop". + + Unix + * It is allowed to rename `pdfcrop.pl' to `pdfcrop': + mv pdfcrop.pl pdfcrop + * Ensure that the execute permission is set: + chmod +x pdfcrop + * Move the file to a directory where the shell can find it + (environment variable PATH, e.g. /usr/local/bin/). + + Dos/Windows/(OS2) + * See requirements. I do not expect that the perl script + run under DOS or Windows. With cygwin it can work however. + +2. Documentation `README': + + Copy it to an appropriate place, for example + `/usr/local/share/doc/pdfcrop/README'. + I is allowed to rename it to `pdfcrop.txt'. + + TDS location: + somewhere below texmf/doc/... (?) + +F. USER INTERFACE +================= +* ToDo: User manual +* Online help: + pdfcrop --help +* Ghostscript's calculation of the bounding box is faster, + if --resolution 72 is used instead of ghostscript's implicite + default setting of 4000 DPI (hint from Ionut Georgescu). + Of course the calculation with higher resolution settings are + more accurate. + +G. AUTHOR +========= +Heiko Oberdiek +Email: oberdiek@uni-freiburg.de + +H. ACKNOWLEDGEMENT +================== +Anthony Williams +Scott Pakin <pakin@uiuc.edu> +Ionut Georgescu +Yves J\"ager + +I. QUESTIONS, SUGGESTED IMPROVEMENTS +==================================== +If you have questions, problems with `pdfcrop', error reports, +if you have improvements or want to have additional features, +please send them to the author. + +My environment for developing and testing: +* linux, SuSE 9.0 +* perl v5.8.1 +* pdfeTeX 3.141592-1.21a-2.1 +* Ghostscript 8.x + +J. KNOWN PROBLEMS +================= +* Perl must support open("-|"). Not every perl port supports this + for older windows (win95, win98). + +K. HISTORY +========== +2002/10/30 v1.0: First release +2002/10/30 v1.1: Option --hires added. +2002/11/04 v1.2: "nul" instead of "/dev/null" for windows. +2002/11/23 v1.3: Use of File::Spec module's "devnull" call. +2002/11/29 v1.4: Option --papersize added. +2004/06/24 v1.5: Clear map file entries so that pdfTeX + does not touch the fonts. +2004/06/26 v1.6: Use mgs.exe instead of gswin32c.exe for MIKTEX. +2005/03/11 v1.7: Support of spaces in file names + (open("-|") is used for ghostscript call). +2008/01/09 v1.8: Fix for moving the temporary file to the output + file across file system boundaries. +2008/04/05 v1.9: Options --resolution and --bbox added. + +L. TODO +======= +* Description of user interface. +* Documentation in other formats, eg. man or info pages. +* Improved error checking. +* Units support for option --margins. +* Perhaps other drivers than pdfTeX, especially VTeX. diff --git a/Master/texmf/scripts/pdfcrop/pdfcrop.pl b/Master/texmf-dist/scripts/pdfcrop/pdfcrop.pl index 97e924b32fb..a13ac745439 100755..100644 --- a/Master/texmf/scripts/pdfcrop/pdfcrop.pl +++ b/Master/texmf-dist/scripts/pdfcrop/pdfcrop.pl @@ -22,8 +22,8 @@ $^W=1; # turn warning on # my $file = "pdfcrop.pl"; my $program = uc($&) if $file =~ /^\w+/; -my $version = "1.8"; -my $date = "2008/01/09"; +my $version = "1.9"; +my $date = "2008/04/05"; my $author = "Heiko Oberdiek"; my $copyright = "Copyright (c) 2002-2008 by $author."; # @@ -41,6 +41,7 @@ my $copyright = "Copyright (c) 2002-2008 by $author."; # (open("-|") is used for ghostscript call). # 2008/01/09 v1.8: Fix for moving the temporary file to the output # file across file system boundaries. +# 2008/04/05 v1.9: Options --resolution and --bbox added. # ### program identification @@ -84,6 +85,8 @@ $::opt_margins = "0 0 0 0"; $::opt_clip = 0; $::opt_hires = 0; $::opt_papersize = ""; +$::opt_resolution = ""; +$::opt_bbox = ""; my $usage = <<"END_OF_USAGE"; ${title}Syntax: \L$program\E [options] <input[.pdf]> [output file] @@ -101,8 +104,14 @@ Options: (defaults:) --(no)clip clipping support, if margins are set ($bool[$::opt_clip]) --(no)hires using `%%HiResBoundingBox' ($bool[$::opt_hires]) instead of `%%BoundingBox' +Expert options: --papersize <foo> parameter for gs's -sPAPERSIZE=<foo>, use only with older gs versions <7.32 ($::opt_papersize) + --resolution <xres>x<yres> () + --resolution <res> pass argument to ghostscript's option -r + Example: --resolution 72 + --bbox "<left> <top> <right> <bottom>" () + override bounding box found by ghostscript Examples: \L$program\E --margins 10 input.pdf output.pdf \L$program\E --margins '5 10 5 20' --clip input.pdf output.pdf @@ -121,6 +130,8 @@ GetOptions( "clip!", "hires!", "papersize=s", + "resolution=s", + "bbox=s", ) or die $usage; !$::opt_help or die $usage; @@ -130,6 +141,18 @@ $::opt_verbose = 1 if $::opt_debug; print $title; +if ($::opt_bbox) { + $::opt_bbox =~ s/^\s+//; + $::opt_bbox =~ s/\s+$//; + $::opt_bbox =~ s/\s+/ /; + if ($::opt_bbox =~ /^-?\d*\.?\d+ -?\d*\.?\d+ -?\d*\.?\d+ -?\d*\.?\d+$/) { + print "* Explicite Bounding Box: $::opt_bbox\n" if $::opt_debug; + } + else { + die "$Error Parse error (option --bbox \"$::opt_bbox\")!\n"; + } +} + @ARGV <= 2 or die "$Error Too many files!\n"; ### input file @@ -208,6 +231,7 @@ my @gsargs = ( "-dNOPAUSE", ); push @gsargs, "-sPAPERSIZE=$::opt_papersize" if $::opt_papersize; +push @gsargs, "-r$::opt_resolution" if $::opt_resolution; push @gsargs, "-c", "save", @@ -269,6 +293,11 @@ print "* Running ghostscript for BoundingBox calculation ...\n" if $::opt_verbose; print "* Ghostscript call: $::opt_gscmd @gsargs\n" if $::opt_debug; +my @bbox; +if ($::opt_bbox) { + $::opt_bbox =~ /([-\d\.]+) ([-\d\.]+) ([-\d\.]+) ([-\d\.]+)/; + @bbox = ($1, $2, $3, $4); +} my $page = 0; my $pid = open(KID_TO_READ, "-|"); if ($pid) { # parent @@ -276,14 +305,16 @@ if ($pid) { # parent my $bb = ($::opt_hires) ? "%%HiResBoundingBox" : "%%BoundingBox"; next unless /^$bb:\s*([\.\d]+) ([\.\d]+) ([\.\d]+) ([\.\d]+)/o; + @bbox = ($1, $2, $3, $4) unless $::opt_bbox; $page++; - print "* Page $page: $1 $2 $3 $4\n" if $::opt_verbose; + print "* Page $page: @bbox\n" if $::opt_verbose; if ($::opt_clip) { - print TMP "\\pageclip $page [$1 $2 $3 $4][$llx $lly $urx $ury]\n"; + print TMP "\\pageclip $page [@bbox][$llx $lly $urx $ury]\n"; } else { - my ($a, $b, $c, $d) = ($1 - $llx, $2 - $ury, $3 + $urx, $4 + $lly); - print TMP "\\page $page [$a $b $c $d]\n"; + my @bb = ($bbox[0] - $llx, $bbox[1] - $ury, + $bbox[2] + $urx, $bbox[3] + $lly); + print TMP "\\page $page [@bb]\n"; } } close(KID_TO_READ) diff --git a/Master/tlpkg/bin/ctan2tds b/Master/tlpkg/bin/ctan2tds index 1d433839bd6..271ab89af0b 100755 --- a/Master/tlpkg/bin/ctan2tds +++ b/Master/tlpkg/bin/ctan2tds @@ -284,7 +284,6 @@ chdir $startdir || die "chdir($startdir) failed: $!"; # back to raw 'pdf-forms-tutorial', "die 'use pdf-forms-tutorial-de or -en'", 'pdf-forms-tutorial-de', "&MAKEpdf_forms_tutorial", 'pdf-forms-tutorial-en', "&MAKEpdf_forms_tutorial", - 'pdfcrop', "die 'skipping, do by hand in Build/source/texk/tetex'", 'pdfpages', "&MAKEunzip", 'pgf', "&MAKEcopy", 'pgfplots', "&MAKEflatten", # .sty's claimed generic aren't, keep latex @@ -733,6 +732,7 @@ $standardfmt='latex'; 'pacioli', 'fonts', 'pdcmac', 'plain', 'pdf-trans', 'generic', + 'pdfcrop', 'generic', 'phaistos', 'fonts', 'philokalia', 'xelatex', 'pictex', 'generic', @@ -1261,6 +1261,7 @@ $standardxmt='\.xmt'; 'a2ping' => '\.pl$', 'epstopdf' => 'epstopdf', 'mkjobtexmf' => '\.pl$', + 'pdfcrop' => '\.pl$', 'perltex' => '\.pl$', 'texcount' => '\.pl$', 'thumbpdf' => '\.pl$', diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index 5dfbf46fd8c..f7578bd881f 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -130,6 +130,7 @@ my @WorkingTLP = qw( ordinalpt papercdcase papertex parallel paresse parrun pauldoc pbox pdf-forms-tutorial-de pdf-forms-tutorial-en pdf-trans pdfcprot + pdfcrop pdfpages pdfscreen pdfsync pdftex-def perception perltex permute pgf pgf-soroban pgfplots phaistos philex philosophersimprint pict2e pictex pictex2 pinlabel pittetd placeins plari plates play diff --git a/Master/tlpkg/tlpsrc/bin-pdftools.tlpsrc b/Master/tlpkg/tlpsrc/bin-pdftools.tlpsrc index 4b8657fd459..6b98c250b4d 100644 --- a/Master/tlpkg/tlpsrc/bin-pdftools.tlpsrc +++ b/Master/tlpkg/tlpsrc/bin-pdftools.tlpsrc @@ -1,16 +1,13 @@ name bin-pdftools category TLCore runpattern f texmf/scripts/epstopdf/epstopdf.pl -runpattern f texmf/scripts/pdfcrop/pdfcrop.pl runpattern f texmf/scripts/tetex/e2pall.pl docpattern f texmf/doc/man/man1/e2pall.1 docpattern f texmf/doc/man/man1/epstopdf.1 docpattern f texmf/doc/man/man1/pdftosrc.1 -docpattern f texmf/doc/pdfcrop/README binpattern f bin/${ARCH}/e2pall binpattern f bin/${ARCH}/epstopdf binpattern f bin/${ARCH}/pdfclose -binpattern f bin/${ARCH}/pdfcrop binpattern f bin/${ARCH}/pdfopen binpattern f bin/${ARCH}/pdftosrc binpattern f bin/win32/pdfatfi.exe diff --git a/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc index 452f8c68d19..1a78817b84a 100644 --- a/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-binextra.tlpsrc @@ -30,5 +30,6 @@ depend cweb depend hyphenex depend mkind-english depend mkjobtexmf +depend pdfcrop depend texcount depend xindy diff --git a/Master/tlpkg/tlpsrc/pdfcrop.tlpsrc b/Master/tlpkg/tlpsrc/pdfcrop.tlpsrc new file mode 100644 index 00000000000..70bba4dcfa3 --- /dev/null +++ b/Master/tlpkg/tlpsrc/pdfcrop.tlpsrc @@ -0,0 +1,4 @@ +name pdfcrop +category Package +runpattern d texmf-dist/scripts/pdfcrop +binpattern f bin/${ARCH}/pdfcrop |