diff options
-rw-r--r-- | Master/texmf-dist/doc/info/epspdf.info | 102 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/epspdf/Changelog | 14 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/epspdf/epspdf.pdf | bin | 227258 -> 226020 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/support/epspdf/epspdf.texi | 30 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/epspdf/images/logo.pdf | bin | 4090 -> 5388 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/support/epspdf/index.html | 76 | ||||
-rw-r--r-- | Master/texmf-dist/scripts/epspdf/epspdf.help | 30 | ||||
-rwxr-xr-x | Master/texmf-dist/scripts/epspdf/epspdf.tlu | 283 | ||||
-rwxr-xr-x | Master/texmf-dist/scripts/epspdf/epspdftk.tcl | 13 |
9 files changed, 256 insertions, 292 deletions
diff --git a/Master/texmf-dist/doc/info/epspdf.info b/Master/texmf-dist/doc/info/epspdf.info index fc7b673fe85..ded018fec0e 100644 --- a/Master/texmf-dist/doc/info/epspdf.info +++ b/Master/texmf-dist/doc/info/epspdf.info @@ -1,8 +1,8 @@ -This is epspdf.info, produced by makeinfo version 5.2 from epspdf.texi. +This is epspdf.info, produced by makeinfo version 6.0 from epspdf.texi. -This manual is for epspdf, version 0.6.2. +This manual is for epspdf, version 0.6.3. -Copyright (C) 2006, 2008, 2009, 2010, 2011, 2013, 2014, 2015 Siep +Copyright (C) 2006, 2008, 2009, 2010, 2011, 2013, 2014, 2015, 2016 Siep Kroonenberg. Copying and distribution of this file, with or without @@ -17,12 +17,12 @@ END-INFO-DIR-ENTRY File: epspdf.info, Node: Top, Next: Usage, Prev: (dir), Up: (dir) -Epspdf and epsdftk -****************** +Epspdf and epspdftk +******************* -This manual is for epspdf, version 0.6.2. +This manual is for epspdf, version 0.6.3. -Copyright (C) 2006, 2008, 2009, 2010, 2011, 2013, 2014, 2015 Siep +Copyright (C) 2006, 2008, 2009, 2010, 2011, 2013, 2014, 2015, 2016 Siep Kroonenberg. Copying and distribution of this file, with or without @@ -218,8 +218,8 @@ shapes or little bitmaps, so use pdftops if available. With newer Ghostscript versions, with an eps2write rather than an epswrite output device, Ghostscript does a much better job. -Under MikTeX, this is also the place to point the program to the -location of pdftops.exe. +Under an older MikTeX without bundled pdftops, this is also the place to +point the program to the location of pdftops.exe. File: epspdf.info, Node: Command-line usage, Next: Notes on PostScript and pdf, Prev: Usage, Up: Top @@ -254,8 +254,8 @@ File: epspdf.info, Node: Option summary, Prev: Command-line usage, Up: Comman Typing 'epspdf --help' gives you the following summary: $ epspdf --help - Epspdf version 0.6.2 - Copyright (c) 2006, 2008, 2009, 2010, 2011, 2013, 2014, 2015 Siep Kroonenberg + Epspdf version 0.6.3 + Copyright (c) 2006, 2008, 2009, 2010, 2011, 2013, 2014, 2015, 2016 Siep Kroonenberg Convert between [e]ps and pdf formats Usage: epspdf[.tlu] [options] infile [outfile] @@ -448,8 +448,9 @@ File: epspdf.info, Node: Windows, Prev: Mac OS X, Up: Bitmapped graphics for 4.3 Windows =========== -Windows is not a particularly friendly environment for PostScript or -pdf. A couple of command-line utilities try to fill the gap, _e.g._ +I know of no built-in facility for converting bitmaps to eps or pdf. +However, many image editors can convert to eps or pdf. A couple of +command-line utilities: sam2p image.png image.eps or bmeps -c image.png image.eps @@ -554,9 +555,10 @@ Logfile. The GUI has a button for viewing log output. This same output is also written to a file 'epspdf.log'. For Linux/Unix/Mac OS X this is in a subdirectory .epspdf of your home directory; for Windows it is in a subdirectory epspdf of '%APPDATA%'. This APPDATA directory may be -'c:\Documents and Settings\YOUR USER NAME\Application Data' or -'c:\Users\YOUR USER NAME\AppData\Roaming'. Type 'echo %APPDATA%' to -find out which. +'c:\Users\YOUR USER NAME\AppData\Roaming' or 'c:\Documents and +Settings\YOUR USER NAME\Application Data'. Type + echo %APPDATA% +in a Command Prompt window to find out which. The logfile lists all epspdf calls and all Ghostscript- and pdftops calls plus error information. @@ -665,39 +667,39 @@ There is now a "-v" (lowercase) option to print the version string. Tag Table: -Node: Top576 -Node: Usage2001 -Node: Overview2204 -Node: Viewing2643 -Node: Conversion options3100 -Ref: gray3242 -Node: Converting3930 -Node: The configuration screen4271 -Node: Command-line usage6724 -Node: Option summary7429 -Node: Notes on PostScript and pdf8758 -Node: Bitmapped and vector9141 -Node: Font embedding10372 -Node: Eps preview headers10902 -Node: Bounding- and other boxes11359 -Node: Orientation12139 -Node: Exporting PostScript or pdf from Windows programs12562 -Node: Bitmapped graphics for LaTeX and pdflatex13446 -Node: Linux13917 -Node: Mac OS X14672 -Node: Windows14990 -Node: Troubleshooting15675 -Node: No options for output format visible16099 -Node: Ghostscript stackunderflow error16403 -Node: Part of the graphic gets cut off16909 -Node: Fonts look ugly17287 -Node: The page has been converted to a bitmap17819 -Node: Temporary files are not removed18295 -Node: Resources for troubleshooting18960 -Ref: Documentation19939 -Node: Change history20190 -Node: Version 0.620361 -Node: Version 0.521210 -Node: Version 0.422692 +Node: Top582 +Node: Usage2015 +Node: Overview2218 +Node: Viewing2657 +Node: Conversion options3114 +Ref: gray3256 +Node: Converting3944 +Node: The configuration screen4285 +Node: Command-line usage6771 +Node: Option summary7476 +Node: Notes on PostScript and pdf8811 +Node: Bitmapped and vector9194 +Node: Font embedding10425 +Node: Eps preview headers10955 +Node: Bounding- and other boxes11412 +Node: Orientation12192 +Node: Exporting PostScript or pdf from Windows programs12615 +Node: Bitmapped graphics for LaTeX and pdflatex13499 +Node: Linux13970 +Node: Mac OS X14725 +Node: Windows15043 +Node: Troubleshooting15751 +Node: No options for output format visible16175 +Node: Ghostscript stackunderflow error16479 +Node: Part of the graphic gets cut off16985 +Node: Fonts look ugly17363 +Node: The page has been converted to a bitmap17895 +Node: Temporary files are not removed18371 +Node: Resources for troubleshooting19036 +Ref: Documentation20044 +Node: Change history20295 +Node: Version 0.620466 +Node: Version 0.521315 +Node: Version 0.422797 End Tag Table diff --git a/Master/texmf-dist/doc/support/epspdf/Changelog b/Master/texmf-dist/doc/support/epspdf/Changelog index 18713161cbe..ed45ae68818 100644 --- a/Master/texmf-dist/doc/support/epspdf/Changelog +++ b/Master/texmf-dist/doc/support/epspdf/Changelog @@ -1,3 +1,17 @@ +2016-05-06 0.6.3 + + Pdf page selection and cropping: simplified and updated the + generated TeX file to be compiled by LuaTeX. Now compatible with + both LuaTeX 0.95 and older versions. + + Windows: test whether pdftops is in TeX binary directory. If so, + do not offer a configuration option for the location of pdftops. + + Minor tweaks to the manual + + Windows executable once more based on Tclkits from Patrick Thoyts + at http://www.patthoyts.tk/tclkit/ + 2015-10-28 0.6.2 Replace obsolete luatex primitives \pdfpagewidth and diff --git a/Master/texmf-dist/doc/support/epspdf/epspdf.pdf b/Master/texmf-dist/doc/support/epspdf/epspdf.pdf Binary files differindex 454d1e03d7c..b4dc5fa6725 100644 --- a/Master/texmf-dist/doc/support/epspdf/epspdf.pdf +++ b/Master/texmf-dist/doc/support/epspdf/epspdf.pdf diff --git a/Master/texmf-dist/doc/support/epspdf/epspdf.texi b/Master/texmf-dist/doc/support/epspdf/epspdf.texi index 456544837ed..debfd8f39cd 100644 --- a/Master/texmf-dist/doc/support/epspdf/epspdf.texi +++ b/Master/texmf-dist/doc/support/epspdf/epspdf.texi @@ -29,7 +29,7 @@ @hyphenation{epspdf-tk epspdf} @end iftex -@set version 0.6.2 +@set version 0.6.3 @set homepage http://tex.aanhet.net/epspdf/ @setchapternewpage off @@ -38,7 +38,7 @@ @copying This manual is for epspdf, version @value{version}. -Copyright @copyright{} 2006, 2008, 2009, 2010, 2011, 2013, 2014, 2015 Siep Kroonenberg. +Copyright @copyright{} 2006, 2008, 2009, 2010, 2011, 2013, 2014, 2015, 2016 Siep Kroonenberg. @quotation Copying and distribution of this file, with or without modification, @@ -67,7 +67,7 @@ without any warranty. @ifnottex @node Top, Usage, (dir), (dir) -@top Epspdf and epsdftk +@top Epspdf and epspdftk @insertcopying @end ifnottex @@ -254,8 +254,8 @@ converted to drawn shapes or little bitmaps, so use pdftops if available. With newer Ghostscript versions, with an eps2write rather than an epswrite output device, Ghostscript does a much better job. -Under MikTeX, this is also the place to point the program to -the location of pdftops.exe. +Under an older MikTeX without bundled pdftops, this is also the place to +point the program to the location of pdftops.exe. @node Command-line usage, Notes on PostScript and pdf, Usage, Top @chapter Command-line usage @@ -287,8 +287,8 @@ epspdf [@var{options}] @var{infile} [@var{outfile}] Typing @kbd{epspdf --help} gives you the following summary: @example $ epspdf --help -Epspdf version 0.6.2 -Copyright (c) 2006, 2008, 2009, 2010, 2011, 2013, 2014, 2015 Siep Kroonenberg +Epspdf version 0.6.3 +Copyright (c) 2006, 2008, 2009, 2010, 2011, 2013, 2014, 2015, 2016 Siep Kroonenberg Convert between [e]ps and pdf formats Usage: epspdf[.tlu] [options] infile [outfile] @@ -452,8 +452,9 @@ excellent alternative to epspdf. @node Windows, , Mac OS X, Bitmapped graphics for @LaTeX{} and pdflatex @section Windows -Windows is not a particularly friendly environment for PostScript or -pdf. A couple of command-line utilities try to fill the gap, @emph{e.g.} +I know of no built-in facility for converting bitmaps to eps or +pdf. However, many image editors can convert to eps or pdf. A couple of +command-line utilities: @example sam2p image.png image.eps @end example @@ -542,10 +543,13 @@ have no trouble removing temporary files manually. output is also written to a file @file{epspdf.log}. For Linux/Unix/Mac OS X this is in a subdirectory .epspdf of your home directory; for Windows it is in a subdirectory epspdf of @file{%APPDATA%}. This APPDATA -directory may be @file{c:\Documents and Settings\@var{your user -name}\Application Data} or @file{c:\Users\@var{your user -name}\AppData\Roaming}. Type -@kbd{echo %APPDATA%} to find out which. +directory may be @file{c:\Users\@var{your user name}\AppData\Roaming} or +@file{c:\Documents and Settings\@var{your user name}\Application +Data}. Type +@example +echo %APPDATA% +@end example +in a Command Prompt window to find out which. The logfile lists all epspdf calls and all Ghostscript- and pdftops calls plus error information. diff --git a/Master/texmf-dist/doc/support/epspdf/images/logo.pdf b/Master/texmf-dist/doc/support/epspdf/images/logo.pdf Binary files differindex 22368065be8..153b771fb26 100644 --- a/Master/texmf-dist/doc/support/epspdf/images/logo.pdf +++ b/Master/texmf-dist/doc/support/epspdf/images/logo.pdf diff --git a/Master/texmf-dist/doc/support/epspdf/index.html b/Master/texmf-dist/doc/support/epspdf/index.html index d1d15d24dea..b8ccb57ce90 100644 --- a/Master/texmf-dist/doc/support/epspdf/index.html +++ b/Master/texmf-dist/doc/support/epspdf/index.html @@ -106,30 +106,29 @@ checked for when epspdf starts:</p> already part of MiKTeX and of TeX Live for Windows, and packaged for most Linux distributions.</li> -<li>Optional: pdftops from the <a - href="http://www.foolabs.com/xpdf/">xpdf suite</a> or from the <a - href="http://poppler.freedesktop.org/">Poppler utilities</a>, or as - a package from your Linux distribution. Pdftops may do a better job - than Ghostscript of preserving scalable fonts when converting from - pdf to ps, although Ghostscript is steadily improving in this - respect. Included in TeX Live for Windows.</li> +<li>Optional: pdftops from + the <a href="http://www.foolabs.com/xpdf/">xpdf suite</a> or from + the <a href="http://poppler.freedesktop.org/">Poppler + utilities</a>, or as a package from your Linux + distribution. Pdftops may do a better job than Ghostscript of + preserving scalable fonts when converting from pdf to ps, although + Ghostscript is steadily improving in this respect. Included in TeX + Live for Windows and in recent versions of MiKTeX. If you have an + old MiKTeX and a copy of pdftops.exe, then you can point epspdf to + this file from within the GUI. You need to do this only once.</li> <li><a href="http://www.tcl.tk/">Tcl/Tk</a> for the GUI - interface. Versions 8.4 through 8.6 have been tested. Packaged for - many or most Linux distributions, and also available from <a - href="http://www.activestate.com/activetcl">ActiveState</a>. Alternatively, - a single-file TclKit runtime will do. The <a - href="http://wiki.tcl.tk/52">TclKit</a> page contains various - links for precompiled binaries.</li> + interface. Version 8.6 has been tested. Packaged for many or most + Linux distributions, and also available + from <a href="http://www.activestate.com/activetcl">ActiveState</a>. + Alternatively, a single-file TclKit runtime will + do. The <a href="http://wiki.tcl.tk/52">TclKit</a> page contains + various links to precompiled binaries.</li> <li>Optional: viewers for PostScript and pdf</li> </ul> -<p>If you have MiKTeX and a copy of pdftops.exe, then you can point -epspdf to this file from within the GUI. You need to do this only -once.</p> - <h2><a name="install" />Installation</h2> <p>If you have a sufficiently recent standalone TeX Live and have a @@ -144,31 +143,31 @@ once.</p> <h3>Windows setup program</h3> <p>This is a conventional Windows installer. If it does not find -texlua.exe on the searchpath then it gives a warning and a opportunity to -abort. It creates a shortcut to the epspdftk GUI and it also creates -an uninstaller.</p> +texlua.exe on the searchpath then it gives a warning and a +opportunity to abort. Note though that texlua only needs to be +available at runtime. It creates a shortcut to the epspdftk GUI and +it also creates an uninstaller.</p> <p>It installs epspdftk in the form of a so-called <em>starpack</em>, which consists of the epspdftk script and a -Tcl/Tk runtime, combined into a single executable. For version 0.6.1, -the Tcl/Tk 8.5 runtime is from the <a -href="http://tclkits.rkeene.org/fossil/wiki/Downloads"> KitCreator -project</a>. The command-line script epspdf.tlu remains a separate -file.</p> +Tcl/Tk runtime, combined into a single executable. The Tcl/Tk 8.6 +runtime is from <a href="http://www.patthoyts.tk/tclkit/"> Patrick +Thoyts’ bleeding edge builds</a>. The command-line +script epspdf.tlu remains a separate file.</p> -<p>This installer has been created with <a -href="http://nsis.sourceforge.net/">NSIS</a>.</p> +<p>This installer has been created +with <a href="http://nsis.sourceforge.net/">NSIS</a> on Linux.</p> <h3>Windows zipfile</h3> <p>Download the epspdf zip file, unpack it somewhere and create a -batchfile epspdf.bat such as</p> +batchfile epspdf.cmd such as</p> <pre> texlua "<path_to_epspdf.tlu>" %* </pre> -<p>for epspdf.tlu, and a batchfile epspdftk.bat</p> +<p>for epspdf.tlu, and a batchfile epspdftk.cmd</p> <pre> wish "<path_to_epspdftk.tcl>" %1 @@ -180,20 +179,20 @@ wish "<path_to_epspdftk.tcl>" %1 be interpreted as startup directory for the file browser. Make sure that wish and these batchfiles are on your searchpath.</p> -<p>Epspdf[tk] has been tested with Windows XP, Windows 7 and -Windows 8.</p> +<p>The current epspdf[tk] has been tested with Windows 7 and +Windows 10.</p> <h2><a name="files" />Files</h2> <ul> - <li><a href="epspdf.0.6.2.tgz">epspdf.0.6.2.tgz</a> preferred for Unix + <li><a href="epspdf.0.6.3.tgz">epspdf.0.6.3.tgz</a> preferred for Unix and Mac OS X</li> -<li><a href="epspdf.0.6.2.zip">epspdf.0.6.2.zip</a> preferred for +<li><a href="epspdf.0.6.3.zip">epspdf.0.6.3.zip</a> preferred for Windows if you don't want to use the installer below</li> -<li><a href="epspdf.0.6.2.exe">epspdf.0.6.2.exe</a> Windows setup +<li><a href="epspdf.0.6.3.exe">epspdf.0.6.3.exe</a> Windows setup program which installs epspdf with a built-in Tcl/Tk runtime: no dependencies beyond a TeX Live- or MiKTeX installation.</li> @@ -203,7 +202,12 @@ Windows if you don't want to use the installer below</li> <ul> -<li>0.6.2 Current version. Small compatibility fix for luatex ≥ +<li>0.6.3 Current version. The LuaTeX code which is generated for + some pdf-to-pdf conversions (page selection and cropping) is now + compatible with LaTeX versions through 0.95 and should work with + TeX Live 2016 and earlier.</li> + +<li>0.6.2 Small compatibility fix for luatex ≥ 0.81.</li> <li>0.6.1 Bug fixes, see Changelog; support for later Ghostscript @@ -218,5 +222,5 @@ Ruby-based versions</a></li> <hr /> -<p class="fineprint">Last revised: November 1, 2015</p> +<p class="fineprint">Last revised: May 2, 2016</p> </body></html> diff --git a/Master/texmf-dist/scripts/epspdf/epspdf.help b/Master/texmf-dist/scripts/epspdf/epspdf.help index d7653c13576..60987a216d0 100644 --- a/Master/texmf-dist/scripts/epspdf/epspdf.help +++ b/Master/texmf-dist/scripts/epspdf/epspdf.help @@ -1,4 +1,4 @@ -Epspdf and epsdftk +Epspdf and epspdftk 1 Usage 1.1 Overview 1.2 Viewing @@ -33,12 +33,12 @@ Epspdf and epsdftk 6.1 Version 0.6 6.2 Version 0.5 6.3 Version 0.4 -Epspdf and epsdftk -****************** +Epspdf and epspdftk +******************* -This manual is for epspdf, version 0.6.2. +This manual is for epspdf, version 0.6.3. -Copyright (C) 2006, 2008, 2009, 2010, 2011, 2013, 2014, 2015 Siep +Copyright (C) 2006, 2008, 2009, 2010, 2011, 2013, 2014, 2015, 2016 Siep Kroonenberg. Copying and distribution of this file, with or without @@ -153,8 +153,8 @@ shapes or little bitmaps, so use pdftops if available. With newer Ghostscript versions, with an eps2write rather than an epswrite output device, Ghostscript does a much better job. -Under MikTeX, this is also the place to point the program to the -location of pdftops.exe. +Under an older MikTeX without bundled pdftops, this is also the place to +point the program to the location of pdftops.exe. 2 Command-line usage ******************** @@ -179,8 +179,8 @@ Basic usage of epspdf itself: Typing 'epspdf --help' gives you the following summary: $ epspdf --help - Epspdf version 0.6.2 - Copyright (c) 2006, 2008, 2009, 2010, 2011, 2013, 2014, 2015 Siep Kroonenberg + Epspdf version 0.6.3 + Copyright (c) 2006, 2008, 2009, 2010, 2011, 2013, 2014, 2015, 2016 Siep Kroonenberg Convert between [e]ps and pdf formats Usage: epspdf[.tlu] [options] infile [outfile] @@ -325,8 +325,9 @@ excellent alternative to epspdf. 4.3 Windows =========== -Windows is not a particularly friendly environment for PostScript or -pdf. A couple of command-line utilities try to fill the gap, _e.g._ +I know of no built-in facility for converting bitmaps to eps or pdf. +However, many image editors can convert to eps or pdf. A couple of +command-line utilities: sam2p image.png image.eps or bmeps -c image.png image.eps @@ -397,9 +398,10 @@ Logfile. The GUI has a button for viewing log output. This same output is also written to a file 'epspdf.log'. For Linux/Unix/Mac OS X this is in a subdirectory .epspdf of your home directory; for Windows it is in a subdirectory epspdf of '%APPDATA%'. This APPDATA directory may be -'c:\Documents and Settings\YOUR USER NAME\Application Data' or -'c:\Users\YOUR USER NAME\AppData\Roaming'. Type 'echo %APPDATA%' to -find out which. +'c:\Users\YOUR USER NAME\AppData\Roaming' or 'c:\Documents and +Settings\YOUR USER NAME\Application Data'. Type + echo %APPDATA% +in a Command Prompt window to find out which. The logfile lists all epspdf calls and all Ghostscript- and pdftops calls plus error information. diff --git a/Master/texmf-dist/scripts/epspdf/epspdf.tlu b/Master/texmf-dist/scripts/epspdf/epspdf.tlu index 7a7c2d78a97..709a2d9b691 100755 --- a/Master/texmf-dist/scripts/epspdf/epspdf.tlu +++ b/Master/texmf-dist/scripts/epspdf/epspdf.tlu @@ -7,9 +7,10 @@ kpse.set_program_name('texlua') -- 0.6.0: first texlua version -- 0.6.1: allow TeX installation on path with spaces -- 0.6.2: compatibility fix for luatex 0.81 +-- 0.6.3: compatibility fixes for luatex 0.9x -ep_version = '0.6.2' -ep_copyright = '2006, 2008, 2009, 2010, 2011, 2013, 2014, 2015' +ep_version = '0.6.3' +ep_copyright = '2006, 2008, 2009, 2010, 2011, 2013, 2014, 2015, 2016' --[[ @@ -58,15 +59,6 @@ POSSIBLE EXTENSIONS -- some general utilities and globals --------------------------- ---[[ - -Simple-minded error handling. At most, we call a function which -tries to write the error message to log before re-raising the error. - -When run from the Tcl/Tk gui, this gui will capture error messages. - ---]] - -- early initializations eol = false @@ -88,9 +80,12 @@ from_gui = false -- whether epspdf is run from the epspsdtk gui cwd = '' --- Windows: miktex, TL or neither +-- Windows: miktex, TL or neither. +-- Actual values determined during system-dependent initialization is_miktex = false is_tl_w32 = false +-- recent versions of miktex include pdftops +auto_psp = true -- configuration of pdftops_prog not needed or not allowed -- some global file- and directory names gs_prog = false @@ -128,6 +123,7 @@ function print_log(s) print(s) -- intercepted by the gui end end + function write_log(s) print_log(string.format('%s %s', os.date('%Y/%m/%d %H:%M:%S', os.time()), s)) @@ -139,6 +135,11 @@ end -- error- and debug ------------------------- +-- Simple-minded error handling. At most, we call a function which +-- tries to write the error message to log before re-raising the error. + +-- When run from the Tcl/Tk gui, this gui will capture error messages. + function errror(mess) if logfile then pcall(write_log, mess) end -- ignore result of pcall: we can do nothing about failure @@ -598,8 +599,8 @@ function write_settings (file) end else -- stdout to be captured by epspdftk f = io.output() - if os.type=='windows' and not is_tl_w32 then - f:write('tl_w = no', eol) + if os.type=='windows' and not auto_psp then + f:write('psp_config = yes', eol) end end for k, v in pairs(settings) do @@ -732,7 +733,7 @@ end -- boundingboxes --------------------------------------------------- --- Bb.coords names now same as those of epdf PDFRectangle +-- [HR]Bb.coords names now same as those of epdf PDFRectangle Bb = {} Bb.coords = {'x1', 'y1', 'x2', 'y2'} @@ -777,7 +778,7 @@ function Bb:from_comment(s) return Bb:from_rect(b) end ---[[ +--[[ some no-longer-used bbox functions function Bb:copy () local b = {} @@ -807,7 +808,7 @@ function Bb:expand () end end --- no longer used: gs handles this +-- gs handles this now -- call this via pcall function Bb:wrapper() local fn = mktemp('ps') @@ -1424,7 +1425,7 @@ function PsPdf:eps_crop() return psp end -- eps_crop ---[===[ real conversions involving a single call of gs or pdftops -------- +--[===[ real conversions involving a single call of gs, pdftops or texlua Each conversion fullfills all options that it can: gray, bbox and page. gray when converting to pdf, bbox when converting from eps or @@ -1458,38 +1459,43 @@ function PsPdf:pdf_crop() errror('PsPdf:pdf_crop called with non-existent page '.. options.page) end local pg = options.page or 1 - local bb, hrbb - if options.bbox then - bb, hrbb = self:bb_from_gs(pg) - else - -- dbg('about to use epdf') - -- use [Trim|Crop|Media]Box instead - -- if os.type=='windows' then waitasec() end - local dummy = epdf.open(self.path) - -- if os.type=='windows' then waitasec() end - if not dummy then + local bb, hrbb, pgbox, pgboxname + do + local pdoc, pcat, ppage + -- we already have the pages, miver and maver properties + -- but need properties of the desired page as well + pdoc = epdf.open(self.path) + if not pdoc then errror('Epdf: cannot open '..self.path) end -- dbg('about to get catalog') - dummy = dummy:getCatalog() - if not dummy then + pcat = pdoc:getCatalog() + if not pcat then errror('Cannot open catalog of '..self.path) end -- dbg('got catalog') - dummy = dummy:getPage(pg) - if not dummy then + ppage = pcat:getPage(pg) + if not ppage then errror('Epdf: cannot open page object '..tostring(pg)..' of '..self.path) end - hrbb = dummy:getTrimBox() - if not hrbb then - hrbb = dummy:getCropBox() + pgboxname = 'trimbox' + pgbox = ppage:getTrimBox() + if not pgbox then + pgboxname = 'cropbox' + pgbox = ppage:getCropBox() end - if not hrbb then - hrbb = dummy:getMediaBox() + if not pgbox then + pgboxname = 'mediabox' + pgbox = ppage:getMediaBox() end - -- further checks, including for non-nil, by Bb:from_rect, - -- which errors out on failures - hrbb = HRBb:from_rect(hrbb) + -- normalization and further checks, including for non-nil, + -- by Bb:from_rect, which errors out on failures + pgbox = HRBb:from_rect(pgbox) + end + if options.bbox then + bb, hrbb = self:bb_from_gs(pg) + else + hrbb = pgbox end -- luatex on searchpath @@ -1497,115 +1503,53 @@ function PsPdf:pdf_crop() -- write TeX file which includes cropped pdf page -- adapted from Heiko Oberdiek's pdfcrop utility. - -- first, create a table with the component strings for the tex source - dummy = {} - dummy[1] = [[ -\catcode37 14 % percent -\catcode33 12 % exclam -\catcode34 12 % quote -\catcode35 6 % hash -\catcode39 12 % apostrophe -\catcode40 12 % left parenthesis -\catcode41 12 % right parenthesis -\catcode45 12 % minus -\catcode46 12 % period -\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 -} - -% future modification: \pdfoutput => \outputmode -\begingroup\expandafter\expandafter\expandafter\endgroup - \expandafter\ifx\csname pdfoutput\endcsname\relax - \let\pdfoutput \outputmode -\fi - -\begingroup - \newlinechar=10 % - \endlinechar=\newlinechar % - \ifnum0% - \directlua{% - if tex.enableprimitives then - tex.enableprimitives('TEST', { - 'luatexversion', - 'pdfoutput', - 'pdfcompresslevel', - 'pdfhorigin', - 'pdfvorigin', - 'pagewidth', - 'pageheight', - 'pdfmapfile', - 'pdfximage', - 'pdflastximage', - 'pdfrefximage', - 'pdfminorversion', - 'pdfobjcompresslevel', - }) - tex.print('1') - end - }% - \ifx\TESTluatexversion\UnDeFiNeD\else 1\fi % - =11 % - \global\let\luatexversion\luatexversion % - \global\let\pdfoutput\TESTpdfoutput % - \global\let\pdfcompresslevel\TESTpdfcompresslevel % - \global\let\pdfhorigin\TESTpdfhorigin % - \global\let\pdfvorigin\TESTpdfvorigin % - \global\let\pagewidth\TESTpagewidth % - \global\let\pageheight\TESTpageheight % - \global\let\pdfmapfile\TESTpdfmapfile % - \global\let\pdfximage\TESTpdfximage % - \global\let\pdflastximage\TESTpdflastximage % - \global\let\pdfrefximage\TESTpdfrefximage % - \global\let\pdfminorversion\TESTpdfminorversion % - \global\let\pdfobjcompresslevel\TESTpdfobjcompresslevel % - \else % - \errmessage{% - Missing \string\luatexversion % - }% - \fi % -\endgroup % - -\pdfoutput=1 % -\pdfcompresslevel=9 % -\csname pdfmapfile\endcsname{} -\def\setpdfversion#1#2{% - \ifnum#2>1 % - \pdfobjcompresslevel=2 % - % including unsupported pdf version! - \pdfinclusionerrorlevel=0 - \pdfminorversion=9\relax - \else - \ifnum#1>4 % - \pdfobjcompresslevel=2 % - \else - \pdfobjcompresslevel=0 % - \fi - \pdfminorversion=#1\relax - \fi -} + -- the table `pieces' will contain the component strings for the tex source + -- first, for texlua <= 0.81 + local pieces = {} + if status.luatex_version <= 80 then + pieces[1] = '\\pdfoutput=1\n' + else + pieces[1] = [[ +\edef\pdfminorversion {\pdfvariable minorversion} +\edef\pdfcompresslevel {\pdfvariable compresslevel} +\edef\pdfobjcompresslevel {\pdfvariable objcompresslevel} +\edef\pdfdecimaldigits {\pdfvariable decimaldigits} +\edef\pdfhorigin {\pdfvariable horigin} +\edef\pdfvorigin {\pdfvariable vorigin} +\let\pdfpagewidth\pagewidth +\let\pdfpageheight\pageheight +\let\pdfximage\saveimageresource +\let\pdfrefximage\useimageresource +\let\pdflastximage\lastsavedimageresourceindex + +\outputmode=1 +]] + end + if self.maver > 1 then + pieces[2] = '\\pdfminorversion=9\n' + else + pieces[2] = '\\pdfminorversion=' .. self.miver .. '\n' + end + if self.maver > 1 or self.miver > 4 then + pieces[3] = [[ +\pdfcompresslevel=9 +\pdfobjcompresslevel=2 +\pdfdecimaldigits=4 +]] + else + pieces[3] = [[ +\pdfcompresslevel=9 +\pdfobjcompresslevel=0 +\pdfdecimaldigits=4 +]] + end + pieces[4] = [[ \def\page #1 [#2 #3 #4 #5]{% \count0=#1\relax \setbox0=\hbox{% \pdfximage page #1 mediabox{]] - dummy[2] = self.path - dummy[3] = [[}% + pieces[5] = self.path + pieces[6] = [[}% \pdfrefximage\pdflastximage }% \pdfhorigin=-#2bp\relax @@ -1618,33 +1562,19 @@ function PsPdf:pdf_crop() \shipout\box0\relax } ]] - -- pdf minor version to write to tex header - local tex_miver = false - if settings.pdf_version=='default' then - tex_miver = self.miver - else - -- in this case, gs should already have converted to - -- a sufficiently low version - tex_miver = tonumber(settings.pdf_version) - if tex_miver>self.miver then - errror('Pdf_crop: forgot to reduce pdf version') - end - end - dummy[4] = string.format([[ -\setpdfversion{%d}{%d} + pieces[7] = string.format([[ \page %d [%f %f %f %f] \csname @@end\endcsname \end ]], - tex_miver, self.maver, options.page or 1, - hrbb.x1, hrbb.y1, hrbb.x2, hrbb.y2) + options.page or 1, hrbb.x1, hrbb.y1, hrbb.x2, hrbb.y2) - local textemp = mktemp('tex') -- this also takes care of pdf: + local textemp = mktemp('tex') -- this also took care of pdf: local pdftemp = string.gsub(textemp, 'tex$', 'pdf') -- if os.type=='windows' then waitasec() end local f = io.open(textemp, 'w') -- if os.type=='windows' then waitasec() end - f:write(table.concat(dummy, '')) + f:write(table.concat(pieces, '')) f:close() local cmd, res, psp if os.type=='unix' then @@ -2137,10 +2067,12 @@ if os.type == 'windows' then cwd = string.gsub(cwd, '\\', '/') end -- prepend (lua)tex directory to searchpath, if not already there maybe_add_path(os.selfdir, false) --- Windows: miktex, TL or neither +-- Windows: miktex, TL or neither. is_miktex, is_tl_w32, auto_psp -- no support yet for separate ghostscript is_miktex = false is_tl_w32 = false +auto_psp = true -- only false for old miktex without included pdftops + if os.type == 'windows' then if string.find (string.lower(kpse.version()), 'miktex') then is_miktex = true @@ -2164,6 +2096,10 @@ if os.type == 'windows' then '/release-texlive.txt; TeX installation not supported.', 0) end -- if isfile end -- if not miktex + -- recent miktex and any windows tl include pdftops + if not lfs.isfile(string.gsub(os.selfdir, '\\', '/') .. '/pdftops.exe') then + auto_psp = false + end end -- if windows -- without Ghostscript we are dead in the water. @@ -2275,7 +2211,8 @@ settings.use_hires_bb = false -- it will not be used for TeX Live and only be read and written on Windows. settings.pdftops_prog = false -descriptions.pdftops_prog = 'Full path to pdftops.exe (not used with TeX Live)' +descriptions.pdftops_prog = + 'Full path to pdftops.exe (not used if TeX bin dir contains pdftops)' settings.use_pdftops = true descriptions.use_pdftops = 'Use pdftops if available' @@ -2408,7 +2345,7 @@ do -- main program help = descriptions.pdf_version } - if os.type=='windows' and not is_tl_w32 then + if os.type=='windows' and not auto_psp then opts.pdftops_prog = { type = 'string', val = nil, forms = {'--pdftops'}, @@ -2497,7 +2434,7 @@ do -- main program 'pdftops_prog', 'use_pdftops', 'save', 'info', 'debug', 'version', 'help'}) do local v = opts[o] - if v~='pdftops_prog' or is_miktex then + if v~='pdftops_prog' or not auto_psp then if v and v.help then local synt = join(v.forms, ', ') if v.type ~= 'boolean' then synt = synt .. ' ' .. v.placeholder end @@ -2518,7 +2455,7 @@ do -- main program end end end - end -- ~=pdftops_prog or is_miktex + end -- ~=pdftops_prog or not auto_psp end -- for if mess then os.exit(1) else os.exit() end end -- help @@ -2660,13 +2597,13 @@ do -- main program -- pdftops program; pdftops has already been been initialized to false -- pdftops_prog as command-line option - if os.type=='windows' and not is_tl_w32 and opts.pdftops_prog.val then + if os.type=='windows' and not auto_psp and + opts.pdftops_prog.val then settings.pdftops_prog = is_prog(opts.pdftops_prog.val) end - -- pdftops should be on the path. - -- for miktex, make it so if possible. - if os.type=='windows' and not is_tl_w32 then + -- pdftops should be on the path. otherwise, make it so if possible. + if os.type=='windows' and not auto_psp then if settings.use_pdftops then pdftops = is_prog(settings.pdftops_prog) if pdftops then @@ -2700,7 +2637,7 @@ do -- main program help() end - -- opts.info.val: need to get infile first + -- opts.info.val: do later; need to get infile first if opts.version.val then show_version() diff --git a/Master/texmf-dist/scripts/epspdf/epspdftk.tcl b/Master/texmf-dist/scripts/epspdf/epspdftk.tcl index e28118853f3..7e4a7bc4c3c 100755 --- a/Master/texmf-dist/scripts/epspdf/epspdftk.tcl +++ b/Master/texmf-dist/scripts/epspdf/epspdftk.tcl @@ -3,7 +3,7 @@ # epspdf conversion utility, GUI frontend ##### -# Copyright (C) 2006, 2008, 2009, 2010, 2011, 2013, 2014, 2015 Siep Kroonenberg +# Copyright (C) 2006, 2008, 2009, 2010, 2011, 2013, 2014, 2015, 2016 Siep Kroonenberg # n dot s dot kroonenberg at rug dot nl # # This program is free software, licensed under the GNU GPL, >=2.0. @@ -95,7 +95,8 @@ proc is_prog {x} { # create a global empty settings array array set ::settings [list] -set ::is_tl 1 +# windows: pdftops from tex distro? +set ::psp_config 0 # ask epspdf.tlu for currently configured settings. # this does not include automatically configured or transient settings. @@ -107,7 +108,7 @@ proc getsettings {} { # write_log "settings from epspdf.tlu:\n$set_str\n" set l [split $set_str "\r\n"] if {$::tcl_platform(platform) eq "windows"} { - set ::is_tl 1 + set ::psp_config 0 set settings(pdftops_prog) "" } foreach e $l { @@ -121,8 +122,8 @@ proc getsettings {} { set val [string trim [string range $e [expr $i+1] end]] if {$val eq "true"} {set val 1} if {$val eq "false"} {set val 0} - if {$para eq "tl_w"} { - set ::is_tl 0 + if {$para eq "psp_config"} { + set ::psp_config 1 write_log "TL for Windows not detected by epspdf" } else { set ::settings($para) $val @@ -503,7 +504,7 @@ spacing .config_t packf [frame .config_t.psf] -ipadx 4 -fill x pack [label .config_t.psf.l_ps -text "Conversion to EPS and PostScript" \ -font boldfont] -anchor w -if {! $::is_tl} { +if { $::psp_config} { if {[string tolower [string range $::settings(pdftops_prog) end-3 end]] ne \ ".exe"} {set ::settings(pdftops_prog) ""} pack [label .config_t.psf.l_pdftops -text "Find pdftops"] -anchor w |