summaryrefslogtreecommitdiff
path: root/Master/bin
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-03-02 00:48:36 +0000
committerKarl Berry <karl@freefriends.org>2008-03-02 00:48:36 +0000
commita06fc6786b17effb92a4606ba6c81f68716ccb73 (patch)
tree1448ee7ac499d21f70abc1c300b4c5f56858aa02 /Master/bin
parentd2ecce6824dc5115d4d2f6390deb4a7a70937aa5 (diff)
start of using symlinks for common scripts
git-svn-id: svn://tug.org/texlive/trunk@6799 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/bin')
l---------[-rwxr-xr-x]Master/bin/i386-linux/epstopdf397
l---------[-rwxr-xr-x]Master/bin/i386-linux/pdfcrop339
2 files changed, 2 insertions, 734 deletions
diff --git a/Master/bin/i386-linux/epstopdf b/Master/bin/i386-linux/epstopdf
index c50dcbbd96d..3287ed667d6 100755..120000
--- a/Master/bin/i386-linux/epstopdf
+++ b/Master/bin/i386-linux/epstopdf
@@ -1,396 +1 @@
-eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q'
- if 0;
-use strict;
-
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
-# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
-# EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-# Change by Thomas Esser, Sept. 1998: The above lines allows us to find
-# perl along $PATH rather than guessing a fixed location. The above
-# construction should work with most shells.
-
-# A script to transform an EPS file so that:
-# a) it is guarenteed to start at the 0,0 coordinate
-# b) it sets a page size exactly corresponding to the BoundingBox
-# This means that when Ghostscript renders it, the result needs no
-# cropping, and the PDF MediaBox is correct.
-# c) the result is piped to Ghostscript and a PDF version written
-#
-# It needs a Level 2 PS interpreter.
-# If the bounding box is not right, of course, you have problems...
-#
-# The only thing I have not allowed for is the case of
-# "%%BoundingBox: (atend)", which is more complicated.
-#
-# Sebastian Rahtz, for Elsevier Science
-#
-# now with extra tricks from Hans Hagen's texutil.
-#
-# History
-# 1999/05/06 v2.5 (Heiko Oberdiek)
-# * New options: --hires, --exact, --filter, --help.
-# * Many cosmetics: title, usage, ...
-# * New code for debug, warning, error
-# * Detecting of cygwin perl
-# * Scanning for %%{Hires,Exact,}BoundingBox.
-# * Scanning only the header in order not to get a wrong
-# BoundingBox of an included file.
-# * (atend) supported.
-# * uses strict; (earlier error detecting).
-# * changed first comment from '%!PS' to '%!';
-# * corrected (atend) pattern: '\s*\(atend\)'
-# * using of $bbxpat in all BoundingBox cases,
-# correct the first white space to '...Box:\s*$bb...'
-# * corrected first line (one line instead of two before 'if 0;';
-# 2000/11/05 v2.6 (Heiko Oberdiek)
-# * %%HiresBoundingBox corrected to %%HiResBoundingBox
-# 2001/03/05 v2.7 (Heiko Oberdiek)
-# * Newline before grestore for the case that there is no
-# whitespace at the end of the eps file.
-# 2002/02/18 v2.8draft (Gerben Wierda)
-# * Handle different eol styles transparantly
-# * Applied fix from Peder Axensten for Freehand bug
-# 2002/02/21 v2.8draft (Gerben Wierda)
-# * Fixed bug where last line of buffer was not copied out (ugh!)
-# 2003/04/22 v2.9draft (Gerben Wierda)
-# * Fixed bug where with cr-eol files everything up to the first %!
-# * in the first 2048 bytes was gobbled (double ugh!)
-# 2004/03/17 v2.9.1draft (Gerben Wierda)
-# * No autorotate page
-# 2005/09/29 v2.9.2draft (Gerben Wierda)
-# * Quote OutFilename
-# 2005/10/01 v2.9.3draft (Gerben Wierda)
-# * Quote OutFilename
-# 2005/10/06 v2.9.4gw (Gerben Wierda)
-# * This has become the official version for now
-# 2005/10/06 v2.9.5gw (Gerben Wierda)
-# * Fixed a horrendous bug in the (atend) handling code
-# 2007/01/24 v2.9.6sw (Staszek Wawrykiewicz)
-# * patched to work also on Windows
-# 2007/05/15 v2.9.6tp (Theo Papadopoulo)
-# * Simplified the (atend) support
-# 2007/05/18 v.2.9.7gw (Gerben Wierda)
-# * Merged both supplied 2.9.6 versions
-# 2007/07/18 v.2.9.8gw
-
-### program identification
-my $program = "epstopdf";
-my $filedate="2007/05/18";
-my $fileversion="2.9.8gw";
-my $copyright = "Copyright 1998-2001 by Sebastian Rahtz et al., 2002-2007 by Gerben Wierda et al. Free software under a BSD-style license.";
-my $title = "\U$program\E $fileversion, $filedate - $copyright\n";
-
-### ghostscript command name
-my $GS = "gs";
-$GS = "gswin32c" if $^O eq 'MSWin32';
-$GS = "gswin32c" if $^O =~ /cygwin/;
-
-### options
-$::opt_help=0;
-$::opt_debug=0;
-$::opt_compress=1;
-$::opt_gs=1;
-$::opt_hires=0;
-$::opt_exact=0;
-$::opt_filter=0;
-$::opt_outfile="";
-
-### usage
-my @bool = ("false", "true");
-my $usage = <<"END_OF_USAGE";
-${title}Syntax: $program [options] <eps file>
-Options:
- --help: print usage
- --outfile=<file>: write result to <file>
- --(no)filter: read standard input (default: $bool[$::opt_filter])
- --(no)gs: run ghostscript (default: $bool[$::opt_gs])
- --(no)compress: use compression (default: $bool[$::opt_compress])
- --(no)hires: scan HiResBoundingBox (default: $bool[$::opt_hires])
- --(no)exact: scan ExactBoundingBox (default: $bool[$::opt_exact])
- --(no)debug: debug informations (default: $bool[$::opt_debug])
-Examples for producing 'test.pdf':
- * $program test.eps
- * produce postscript | $program --filter >test.pdf
- * produce postscript | $program -f -d -o=test.pdf
-Example: look for HiResBoundingBox and produce corrected PostScript:
- * $program -d --nogs -hires test.ps>testcorr.ps
-END_OF_USAGE
-
-### process options
-use Getopt::Long;
-GetOptions (
- "help!",
- "debug!",
- "filter!",
- "compress!",
- "gs!",
- "hires!",
- "exact!",
- "outfile=s",
-) or die $usage;
-
-### help functions
-sub debug {
- print STDERR "* @_\n" if $::opt_debug;
-}
-sub warning {
- print STDERR "==> Warning: @_!\n";
-}
-sub error {
- die "$title!!! Error: @_!\n";
-}
-sub errorUsage {
- die "$usage\n!!! Error: @_!\n";
-}
-
-### option help
-die $usage if $::opt_help;
-
-### get input filename
-my $InputFilename = "";
-if ($::opt_filter) {
- @ARGV == 0 or
- die errorUsage "Input file cannot be used with filter option";
- $InputFilename = "-";
- debug "Input file: standard input";
-}
-else {
- @ARGV > 0 or die errorUsage "Input filename missing";
- @ARGV < 2 or die errorUsage "Unknown option or too many input files";
- $InputFilename = $ARGV[0];
- -f $InputFilename or error "\"$InputFilename\" does not exist";
- debug "Input filename:", $InputFilename;
-}
-
-### option compress
-my $GSOPTS = "";
-$GSOPTS = "-dUseFlateCompression=false " unless $::opt_compress;
-
-### option BoundingBox types
-my $BBName = "%%BoundingBox:";
-!($::opt_hires and $::opt_exact) or
- error "Options --hires and --exact cannot be used together";
-$BBName = "%%HiResBoundingBox:" if $::opt_hires;
-$BBName = "%%ExactBoundingBox:" if $::opt_exact;
-debug "BoundingBox comment:", $BBName;
-
-### option outfile
-my $OutputFilename = $::opt_outfile;
-if ($OutputFilename eq "") {
- if ($::opt_gs) {
- $OutputFilename = $InputFilename;
- if (!$::opt_filter) {
- $OutputFilename =~ s/\.[^\.]*$//;
- $OutputFilename .= ".pdf";
- }
- }
- else {
- $OutputFilename = "-"; # standard output
- }
-}
-if ($::opt_filter) {
- debug "Output file: standard output";
-}
-else {
- debug "Output filename:", $OutputFilename;
-}
-
-### option gs
-if ($::opt_gs) {
- debug "Ghostscript command:", $GS;
- debug "Compression:", ($::opt_compress) ? "on" : "off";
-}
-
-### open input file
-open(IN,"<$InputFilename") or error "Cannot open",
- ($::opt_filter) ? "standard input" : "\"$InputFilename\"";
-binmode IN;
-
-### open output file
-if ($::opt_gs) {
- my $pipe = "$GS -q -sDEVICE=pdfwrite $GSOPTS -dAutoRotatePages=/None" .
- " -sOutputFile=\"$OutputFilename\" - -c quit";
- debug "Ghostscript pipe:", $pipe;
- open(OUT,"|$pipe") or error "Cannot open Ghostscript for piped input";
-}
-else {
- open(OUT,">$OutputFilename") or error "Cannot write \"$OutputFilename\"";
-}
-
-# reading a cr-eol file on a lf-eol system makes it impossible to parse
-# the header and besides it will read the intire file into yor line by line
-# scalar. this is also true the other way around.
-
-### scan a block, try to determine eol style
-
-my $buf;
-my $buflen;
-my @bufarray;
-my $bufarraypos;
-
-# We assume 2048 is big enough.
-my $EOLSCANBUFSIZE = 2048;
-
-$buflen = read( IN, $buf, $EOLSCANBUFSIZE);
-if ($buflen > 0) {
- my $crlfpos;
- my $lfpos;
- my $crpos;
-
- # remove binary junk before header
- # if there is no header, we assume the file starts with ascii style and
- # we look for a eol style anyway, to prevent possible loading of the
- # entire file
- if ($buf =~ /%!/) {
- # throw away binary junk before %!
- $buf =~ s/(.*?)%!/%!/o;
- }
- $lfpos = index( $buf, "\n");
- $crpos = index( $buf, "\r");
- $crlfpos = index( $buf, "\r\n");
-
- if ($crpos > 0 and ($lfpos == -1 or $lfpos > $crpos+1)) {
- # The first eol was a cr and it was not immediately followed by a lf
- $/ = "\r";
- debug "The first eol character was a CR ($crpos) and not immediately followed by a LF ($lfpos)";
- }
-
- # Now we have set the correct eol-character. Get one more line and add
- # it to our buffer. This will make the buffer contain an entire line
- # at the end. Then split the buffer in an array. We will draw lines from
- # that array until it is empty, then move again back to <IN>
- $buf .= <IN> unless eof( IN);
- $buflen = length( $buf);
- $bufarraypos = 0;
-
- # Some extra magic is needed here: if we set $/ to \r, Perl's re engine
- # still thinks eol is \n in regular expressions (not very nice) so we
- # cannot split on ^, but have to split on \r and reappend those.
- if ($/ eq "\r") {
- @bufarray = split( /\r/ms, $buf); # split on \r
- grep( $_ .= "\r", @bufarray); # re-append \r to each array item
- }
- else {
- @bufarray = split( /^/ms, $buf);
- }
-}
-
-### getline
-sub getline {
- if ($#bufarray >= 0) {
- $_ = shift( @bufarray);
- $bufarraypos += length( $_);
- # debug "getline from array. bufarraypos = $bufarraypos";
- # debug "*** READ: $_";
- }
- else {
- $_ = <IN>;
- }
- return( defined( $_));
-}
-
-### scan first line
-my $header = 0;
-getline();
-if (/%!/) {
- # throw away binary junk before %!
- s/(.*)%!/%!/o;
-}
-$header = 1 if /^%/;
-debug "Scanning header for BoundingBox";
-print OUT;
-
-### variables and pattern for BoundingBox search
-my $bbxpatt = '[0-9eE\.\-]';
- # protect backslashes: "\\" gets '\'
-my $BBValues = "\\s*($bbxpatt+)\\s+($bbxpatt+)\\s+($bbxpatt+)\\s+($bbxpatt+)";
-my $BBCorrected = 0;
-
-sub CorrectBoundingBox {
- my ($llx, $lly, $urx, $ury) = @_;
- debug "Old BoundingBox:", $llx, $lly, $urx, $ury;
- my ($width, $height) = ($urx - $llx, $ury - $lly);
- my ($xoffset, $yoffset) = (-$llx, -$lly);
- debug "New BoundingBox: 0 0", $width, $height;
- debug "Offset:", $xoffset, $yoffset;
-
- print OUT "%%BoundingBox: 0 0 $width $height\n";
- print OUT "<< /PageSize [$width $height] >> setpagedevice\n";
- print OUT "gsave $xoffset $yoffset translate\n";
-}
-
-### scan header
-if ($header) {
- HEADER: while (getline()) {
- ### Fix for freehand bug ### by Peder Axensten
- next HEADER if(!/\S/);
-
- ### end of header
- if (!/^%/ or /^%%EndComments/) {
- print OUT;
- last;
- }
-
- ### BoundingBox with values
- if (/^$BBName$BBValues/) {
- CorrectBoundingBox $1, $2, $3, $4;
- $BBCorrected = 1;
- last;
- }
-
- ### BoundingBox with (atend)
- if (/^$BBName\s*\(atend\)/) {
- debug $BBName, "(atend)";
- if ($::opt_filter) {
- warning "Cannot look for BoundingBox in the trailer",
- "with option --filter";
- last;
- }
- my $pos = tell(OUT)+length($_);
- debug "Current file position:", $pos;
-
- # looking for %%BoundingBox
- while (getline()) {
- # skip over included documents
- if (/^%%BeginDocument/) {
- while (getline()) {
- last if /^%%EndDocument/;
- }
- }
- if (/^$BBName$BBValues/) {
- CorrectBoundingBox $1, $2, $3, $4;
- $BBCorrected = 1;
- last;
- }
- }
-
- # go back
- seek( IN, $pos, 0) or error "Cannot go back to line \"$BBName (atend)\"";
- last;
- }
-
- # print header line
- print OUT;
- }
-}
-
-### print rest of file
-while (getline()) {
- print OUT;
-}
-
-### close files
-close(IN);
-print OUT "\ngrestore\n" if $BBCorrected;
-close(OUT);
-warning "BoundingBox not found" unless $BBCorrected;
-debug "Ready.";
-;
+../../texmf/scripts/epstopdf/epstopdf.pl \ No newline at end of file
diff --git a/Master/bin/i386-linux/pdfcrop b/Master/bin/i386-linux/pdfcrop
index 97e924b32fb..0e7f657875b 100755..120000
--- a/Master/bin/i386-linux/pdfcrop
+++ b/Master/bin/i386-linux/pdfcrop
@@ -1,338 +1 @@
-eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q'
- if 0;
-use strict;
-$^W=1; # turn warning on
-#
-# pdfcrop.pl
-#
-# 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.
-#
-# See file "README" for a list of files that belong to this project.
-#
-# This file "pdfcrop.pl" may be renamed to "pdfcrop"
-# for installation purposes.
-#
-my $file = "pdfcrop.pl";
-my $program = uc($&) if $file =~ /^\w+/;
-my $version = "1.8";
-my $date = "2008/01/09";
-my $author = "Heiko Oberdiek";
-my $copyright = "Copyright (c) 2002-2008 by $author.";
-#
-# Reqirements: Perl5, Ghostscript
-# 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.
-#
-
-### program identification
-my $title = "$program $version, $date - $copyright\n";
-
-### error strings
-my $Error = "!!! Error:"; # error prefix
-
-### string constants for Ghostscript run
-# get Ghostscript command name
-my $GS = "gs";
-$GS = "gs386" if $^O =~ /dos/i;
-$GS = "gsos2" if $^O =~ /os2/i;
-$GS = "gswin32c" if $^O =~ /mswin32/i;
-$GS = "gswin32c" if $^O =~ /cygwin/i;
-$GS = "mgs" if defined($ENV{"TEXSYSTEM"}) and
- $ENV{"TEXSYSTEM"} =~ /miktex/i;
-
-# Windows detection (no SIGHUP)
-my $Win = 0;
-$Win = 1 if $^O =~ /mswin32/i;
-$Win = 1 if $^O =~ /cygwin/i;
-
-# "null" device
-use File::Spec::Functions qw(devnull);
-my $null = devnull();
-
-### variables
-my $inputfile = "";
-my $outputfile = "";
-my $tmp = "tmp-\L$program\E-$$";
-
-### option variables
-my @bool = ("false", "true");
-$::opt_help = 0;
-$::opt_debug = 0;
-$::opt_verbose = 0;
-$::opt_gscmd = $GS;
-$::opt_pdftexcmd = "pdftex";
-$::opt_margins = "0 0 0 0";
-$::opt_clip = 0;
-$::opt_hires = 0;
-$::opt_papersize = "";
-
-my $usage = <<"END_OF_USAGE";
-${title}Syntax: \L$program\E [options] <input[.pdf]> [output file]
-Function: Margins are calculated and removed for each page in the file.
-Options: (defaults:)
- --help print usage
- --(no)verbose verbose printing ($bool[$::opt_verbose])
- --(no)debug debug informations ($bool[$::opt_debug])
- --gscmd <name> call of ghostscript ($::opt_gscmd)
- --pdftexcmd <name> call of pdfTeX ($::opt_pdftexcmd)
- --margins "<left> <top> <right> <bottom>" ($::opt_margins)
- add extra margins, unit is bp. If only one number is
- given, then it is used for all margins, in the case
- of two numbers they are also used for right and bottom.
- --(no)clip clipping support, if margins are set ($bool[$::opt_clip])
- --(no)hires using `%%HiResBoundingBox' ($bool[$::opt_hires])
- instead of `%%BoundingBox'
- --papersize <foo> parameter for gs's -sPAPERSIZE=<foo>,
- use only with older gs versions <7.32 ($::opt_papersize)
-Examples:
- \L$program\E --margins 10 input.pdf output.pdf
- \L$program\E --margins '5 10 5 20' --clip input.pdf output.pdf
-END_OF_USAGE
-
-### process options
-my @OrgArgv = @ARGV;
-use Getopt::Long;
-GetOptions(
- "help!",
- "debug!",
- "verbose!",
- "gscmd=s",
- "pdftexcmd=s",
- "margins=s",
- "clip!",
- "hires!",
- "papersize=s",
-) or die $usage;
-!$::opt_help or die $usage;
-
-$::opt_verbose = 1 if $::opt_debug;
-
-@ARGV >= 1 or die $usage;
-
-print $title;
-
-@ARGV <= 2 or die "$Error Too many files!\n";
-
-### input file
-$inputfile = shift @ARGV;
-
-if (! -f $inputfile) {
- if (-f "$inputfile.pdf") {
- $inputfile .= ".pdf";
- }
- else {
- die "$Error Input file `$inputfile' not found!\n";
- }
-}
-
-print "* Input file: $inputfile\n" if $::opt_debug;
-
-### output file
-if (@ARGV) {
- $outputfile = shift @ARGV;
-}
-else {
- $outputfile = $inputfile;
- $outputfile =~ s/\.pdf$//i;
- $outputfile .= "-crop.pdf";
-}
-
-print "* Output file: $outputfile\n" if $::opt_debug;
-
-### margins
-my ($llx, $lly, $urx, $ury) = (0, 0, 0, 0);
-if ($::opt_margins =~
- /^\s*([\-\.\d]+)\s+([\-\.\d]+)\s+([\-\.\d]+)\s+([\-\.\d]+)\s*$/) {
- ($llx, $lly, $urx, $ury) = ($1, $2, $3, $4);
-}
-else {
- if ($::opt_margins =~ /^\s*([\-\.\d]+)\s+([\-\.\d]+)\s*$/) {
- ($llx, $lly, $urx, $ury) = ($1, $2, $1, $2);
- }
- else {
- if ($::opt_margins =~ /^\s*([\-\.\d]+)\s*$/) {
- ($llx, $lly, $urx, $ury) = ($1, $1, $1, $1);
- }
- else {
- die "$Error Parse error (option --margins)!\n";
- }
- }
-}
-print "* Margins: $llx $lly $urx $ury\n" if $::opt_debug;
-
-### cleanup system
-my @unlink_files = ();
-my $exit_code = 1;
-sub clean {
- print "* Cleanup\n" if $::opt_debug;
- if ($::opt_debug) {
- print "* Temporary files: @unlink_files\n";
- }
- else {
- for (; @unlink_files>0; ) {
- unlink shift @unlink_files;
- }
- }
-}
-sub cleanup {
- clean();
- exit($exit_code);
-}
-$SIG{'INT'} = \&cleanup;
-$SIG{'__DIE__'} = \&clean;
-
-### Calculation of BoundingBoxes
-
-my @gsargs = (
- "-sDEVICE=bbox",
- "-dBATCH",
- "-dNOPAUSE",
-);
-push @gsargs, "-sPAPERSIZE=$::opt_papersize" if $::opt_papersize;
-push @gsargs,
- "-c",
- "save",
- "pop",
- "-f",
- $inputfile
-;
-
-my $tmpfile = "$tmp.tex";
-push @unlink_files, $tmpfile;
-open(TMP, ">$tmpfile") or
- die "$Error Cannot write tmp file `$tmpfile'!\n";
-print TMP "\\def\\pdffile{$inputfile}\n";
-print TMP <<'END_TMP_HEAD';
-\csname pdfmapfile\endcsname{}
-\def\page #1 [#2 #3 #4 #5]{%
- \count0=#1\relax
- \setbox0=\hbox{%
- \pdfximage page #1{\pdffile}%
- \pdfrefximage\pdflastximage
- }%
- \pdfhorigin=-#2bp\relax
- \pdfvorigin=#3bp\relax
- \pdfpagewidth=#4bp\relax
- \advance\pdfpagewidth by -#2bp\relax
- \pdfpageheight=#5bp\relax
- \advance\pdfpageheight by -#3bp\relax
- \ht0=\pdfpageheight
- \shipout\box0\relax
-}
-\def\pageclip #1 [#2 #3 #4 #5][#6 #7 #8 #9]{%
- \count0=#1\relax
- \dimen0=#4bp\relax \advance\dimen0 by -#2bp\relax
- \edef\imagewidth{\the\dimen0}%
- \dimen0=#5bp\relax \advance\dimen0 by -#3bp\relax
- \edef\imageheight{\the\dimen0}%
- \pdfximage page #1{\pdffile}%
- \setbox0=\hbox{%
- \kern -#2bp\relax
- \lower #3bp\hbox{\pdfrefximage\pdflastximage}%
- }%
- \wd0=\imagewidth\relax
- \ht0=\imageheight\relax
- \dp0=0pt\relax
- \pdfhorigin=#6pt\relax
- \pdfvorigin=#7bp\relax
- \pdfpagewidth=\imagewidth
- \advance\pdfpagewidth by #6bp\relax
- \advance\pdfpagewidth by #8bp\relax
- \pdfpageheight=\imageheight\relax
- \advance\pdfpageheight by #7bp\relax
- \advance\pdfpageheight by #9bp\relax
- \pdfxform0\relax
- \shipout\hbox{\pdfrefxform\pdflastxform}%
-}%
-END_TMP_HEAD
-
-print "* Running ghostscript for BoundingBox calculation ...\n"
- if $::opt_verbose;
-print "* Ghostscript call: $::opt_gscmd @gsargs\n" if $::opt_debug;
-
-my $page = 0;
-my $pid = open(KID_TO_READ, "-|");
-if ($pid) { # parent
- while (<KID_TO_READ>) {
- my $bb = ($::opt_hires) ? "%%HiResBoundingBox" : "%%BoundingBox";
- next unless
- /^$bb:\s*([\.\d]+) ([\.\d]+) ([\.\d]+) ([\.\d]+)/o;
- $page++;
- print "* Page $page: $1 $2 $3 $4\n" if $::opt_verbose;
- if ($::opt_clip) {
- print TMP "\\pageclip $page [$1 $2 $3 $4][$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";
- }
- }
- close(KID_TO_READ)
- || die "!!! Error: Execution of ghostscript failed: $?\n";
-}
-else { # child
- open STDERR, '>&STDOUT' or die "!!! Error: Cannot redirect stderr: $!\n";
- open STDOUT, ">$null" or die "!!! Error: Cannot write to $null!\n";
- exec($::opt_gscmd, @gsargs)
- || die "!!! Error: Ghostscript run failed: $!\n";
- # NOT REACHED
-}
-
-print TMP "\\csname \@\@end\\endcsname\n\\end\n";
-close(TMP);
-
-### Run pdfTeX
-
-push @unlink_files, "$tmp.log";
-my $cmd;
-if ($::opt_verbose) {
- $cmd = "$::opt_pdftexcmd -interaction=nonstopmode $tmp";
-}
-else {
- $cmd = "$::opt_pdftexcmd -interaction=batchmode $tmp";
-}
-print "* Running pdfTeX ...\n" if $::opt_verbose;
-print "* pdfTeX call: $cmd\n" if $::opt_debug;
-if ($::opt_verbose) {
- system($cmd);
-}
-else {
- `$cmd`;
-}
-if ($?) {
- die "$Error pdfTeX run failed!\n";
-}
-
-### Move temp file to output
-if (!rename("$tmp.pdf", $outputfile)) {
- use File::Copy;
- move "$tmp.pdf", $outputfile or
- die "$Error Cannot move `$tmp.pdf' to `$outputfile'!\n";
-}
-
-print "==> $page page", (($page == 1) ? "" : "s"),
- " written on `$outputfile'.\n";
-
-$exit_code = 0;
-cleanup();
-
-__END__
+../../texmf/scripts/pdfcrop/pdfcrop.pl \ No newline at end of file