summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinhard Kotucha <reinhard.kotucha@web.de>2022-12-26 19:12:37 +0000
committerReinhard Kotucha <reinhard.kotucha@web.de>2022-12-26 19:12:37 +0000
commitebf911eca7fd5774313ec4494015f4dd17cd8597 (patch)
tree1dc46010469ec82214a01e625df986aae04890fb
parent807ee9e2eebd6fdbf7db015353187c6abc14b2bf (diff)
Scripts revised, pdf2ps added, unused ps2ps2.exe removed.
runcript.tlu: scaerch order changed (.lua first, .texlua last). git-svn-id: svn://tug.org/texlive/trunk@65362 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xMaster/bin/win32/pdf2ps.exe (renamed from Master/bin/win32/ps2ps2.exe)bin1536 -> 1536 bytes
-rwxr-xr-xMaster/bin/win32/runscript.tlu4
-rwxr-xr-xMaster/texmf-dist/scripts/tlgs/eps2eps.lua40
-rwxr-xr-xMaster/texmf-dist/scripts/tlgs/gswin32/eps2eps.tlu142
-rwxr-xr-xMaster/texmf-dist/scripts/tlgs/gswin32/pdf2dsc.tlu74
-rwxr-xr-xMaster/texmf-dist/scripts/tlgs/gswin32/pdfopt.tlu165
-rwxr-xr-xMaster/texmf-dist/scripts/tlgs/gswin32/ps2ascii.tlu128
-rwxr-xr-xMaster/texmf-dist/scripts/tlgs/gswin32/ps2pdf.tlu165
-rwxr-xr-xMaster/texmf-dist/scripts/tlgs/gswin32/ps2pdf12.tlu165
-rwxr-xr-xMaster/texmf-dist/scripts/tlgs/gswin32/ps2pdf13.tlu165
-rwxr-xr-xMaster/texmf-dist/scripts/tlgs/gswin32/ps2pdf14.tlu165
-rwxr-xr-xMaster/texmf-dist/scripts/tlgs/gswin32/ps2ps.tlu139
-rwxr-xr-xMaster/texmf-dist/scripts/tlgs/pdf2dsc.lua36
-rwxr-xr-xMaster/texmf-dist/scripts/tlgs/pdf2ps.lua45
-rwxr-xr-xMaster/texmf-dist/scripts/tlgs/pdfopt.lua47
-rwxr-xr-xMaster/texmf-dist/scripts/tlgs/ps2ascii.lua39
-rwxr-xr-xMaster/texmf-dist/scripts/tlgs/ps2pdf.lua43
-rwxr-xr-xMaster/texmf-dist/scripts/tlgs/ps2pdf12.lua43
-rwxr-xr-xMaster/texmf-dist/scripts/tlgs/ps2pdf13.lua43
-rwxr-xr-xMaster/texmf-dist/scripts/tlgs/ps2pdf14.lua43
-rwxr-xr-xMaster/texmf-dist/scripts/tlgs/ps2ps.lua39
-rw-r--r--Master/texmf-dist/scripts/tlgs/tlgs-common329
-rw-r--r--Master/tlpkg/tlpsrc/tlgs.win32.tlpsrc2
23 files changed, 750 insertions, 1311 deletions
diff --git a/Master/bin/win32/ps2ps2.exe b/Master/bin/win32/pdf2ps.exe
index 5777d90a17a..5777d90a17a 100755
--- a/Master/bin/win32/ps2ps2.exe
+++ b/Master/bin/win32/pdf2ps.exe
Binary files differ
diff --git a/Master/bin/win32/runscript.tlu b/Master/bin/win32/runscript.tlu
index 58ea0c4742d..5140e9af1af 100755
--- a/Master/bin/win32/runscript.tlu
+++ b/Master/bin/win32/runscript.tlu
@@ -853,8 +853,8 @@ end
if not ARGV then
os.setenv('TEXMF', TEXMFDIST)
- local extlist = '.tlu;.texlua;.pl;.lua;.rb;.py;.tcl;.jar;.vbs;.js;.bat;.cmd;\0'
- local progfullname = search_path(progname, BINDIR, '.tlu;.bat;.cmd') or
+ local extlist = '.lua;.tlu;.pl;.rb;.py;.tcl;.jar;.vbs;.js;.bat;.cmd;.texlua;\0'
+ local progfullname = search_path(progname, BINDIR, '.lua;.tlu;.bat;.cmd') or
find_texmfscript(progname, extlist)
os.setenv('TEXMF', nil)
if progfullname == nil then
diff --git a/Master/texmf-dist/scripts/tlgs/eps2eps.lua b/Master/texmf-dist/scripts/tlgs/eps2eps.lua
new file mode 100755
index 00000000000..23da82d641d
--- /dev/null
+++ b/Master/texmf-dist/scripts/tlgs/eps2eps.lua
@@ -0,0 +1,40 @@
+#!/usr/bin/env texlua
+--*-Lua-*-
+-- $Id$
+
+-- Copyright (C) 2008-2022 Reinhard Kotucha.
+-- You may freely use, modify and/or distribute this file.
+
+doc = {
+ invocation = '[options] <inputfile> <outputfile>',
+ synopsis = '"Distill" Encapsulated PostScript.',
+ details = [=[
+ <inputfile> can be either an EPS or PS file. A single hyphen (-)
+ denotes stdin.
+
+ <outputfile> is an EPS file with a re-calculated BoundingBox.
+ A single hyphen (-) denotes stdout.
+]=]}
+
+dofile(arg[0]:match('(.*[/\\]).*$')..'tlgs-common')
+
+local command = {gsname()}
+
+addto(command,
+ '-sDEVICE=eps2write',
+ '-dDEVICEWIDTH=250000',
+ '-dDEVICEHEIGHT=250000',
+ '-o'..file.output,
+ options,
+ '-f',
+ file.input)
+
+execute(command)
+
+-- Local Variables:
+-- mode: Lua
+-- lua-indent-level: 2
+-- indent-tabs-mode: nil
+-- coding: utf-8-unix
+-- End:
+-- vim:set tabstop=2 expandtab:
diff --git a/Master/texmf-dist/scripts/tlgs/gswin32/eps2eps.tlu b/Master/texmf-dist/scripts/tlgs/gswin32/eps2eps.tlu
deleted file mode 100755
index ec592e54624..00000000000
--- a/Master/texmf-dist/scripts/tlgs/gswin32/eps2eps.tlu
+++ /dev/null
@@ -1,142 +0,0 @@
-#!/usr/bin/env texlua
---*-Lua-*-
--- $Id$
-
--- Copyright (C) 2008-2015 Reinhard Kotucha.
--- You may freely use, modify and/or distribute this file.
-
--- Replacement for eps2eps.bat.
--- 'Distill' Encapsulated PostScript.
-
-
-local function usage (progname)
- local message=
- 'Usage: '..progname..' [options] <inputfile> <outputfile>\n'..
- ' <inputfile> can be either a PS, EPS, PDF file, or stdin.\n'..
- ' A single hyphen (-) denotes stdin.\n'
- return message
-end
-
-
-function fixwin(args_unix)
- if os.type == 'windows' then
- local args_win={} -- new table
- args_win[0]=args_unix[1]
- for i=1, #args_unix do
- args_win[i]='"'..args_unix[i]..'"'
- end
- return args_win
- else
- return args_unix
- end
-end
-
-
-local function push (t, ...)
- local args={...}
- for _,v in ipairs(args) do
- if type(v) == 'table' then
- for _,x in ipairs(v) do
- t[#t+1]=x
- end
- else
- t[#t+1]=v
- end
- end
-end
-
-
-local function filename (file)
- -- strip path
- if string.find(file, '[/\\]') then
- return string.match(file, '.*[/\\](.*)$')
- else
- return file
- end
-end
-
-
-local function basename (file)
- -- strip extension
- return string.match(filename(file), '(.*)%..*')
-end
-
-
-local function extension (file)
- -- return extension if available, false otherwise.
- local fn=filename(file)
- if fn:find('%.') then
- return string.match(fn, '.*%.(.*)')
- else
- return false
- end
-end
-
-
-local function parse_cmdline ()
- local files={}
- local options={}
-
- local progname
- local basename=filename(arg[0])
- if basename:find('%.') then
- progname=basename:match('(.*)%..*')
- else
- progname=basename
- end
-
- for i=1, #arg do
- if string.find(arg[i], '^%-.+') then
- push(options, arg[i])
- else
- push(files, arg[i])
- end
- end
- files.input =files[1]
- files.output=files[2]
-
- return progname, options, files
-end
-
-
-local function check_files (progname, files)
- if #files < 2 then
- io.stderr:write(usage(progname))
- os.exit(1)
- end
-end
-
--- main --
-
--- parse command line
-local progname, options, file=parse_cmdline()
-
-check_files (progname, file)
-
--- setup command
-
-local command={}
-if os.type == 'unix' then command={'gs'} else command={'gswin32c'} end
-
-push(command, '-q', '-sDEVICE=eps2write')
-
-if os.type=='unix' then push (command, '-sstdout=%stderr') end
-
-push(command, '-sOutputFile='..file.output, '-dNOPAUSE',
- '-dBATCH', '-P-', '-dALLOWPSTRANSPARENCY', '-dDEVICEWIDTH=250000',
- '-dDEVICEHEIGHT=250000')
-
-push(command, options)
-push(command, file.input)
-
-command=fixwin(command)
-
---[[ prepend an additional hyphen to activate this code
-for i=0, #command do
- print (command[i])
-end
-os.exit(0)
---]]
-
-ret=os.spawn(command)
-os.exit(ret)
diff --git a/Master/texmf-dist/scripts/tlgs/gswin32/pdf2dsc.tlu b/Master/texmf-dist/scripts/tlgs/gswin32/pdf2dsc.tlu
deleted file mode 100755
index 476a5169243..00000000000
--- a/Master/texmf-dist/scripts/tlgs/gswin32/pdf2dsc.tlu
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/env texlua
---*-Lua-*-
--- $Id$
-
--- Copyright (C) 2007 Reinhard Kotucha.
--- You may freely use, modify and/or distribute this file.
-
--- Replacement for pdf2dsc.bat.
--- Convert PDF to DSC
-
-function fixwin (args_unix)
- if os.type == 'windows' then
- local args_win={} -- new table
- args_win[0]=args_unix[1]
- for i=1, #args_unix do
- args_win[i]='"'..args_unix[i]..'"'
- end
- return args_win
- else
- return args_unix
- end
-end
-
-
-local function push (t, ...)
- local args={...}
- for _,v in ipairs(args) do
- if type(v) == 'table' then
- for _,x in ipairs(v) do
- t[#t+1]=x
- end
- else
- t[#t+1]=v
- end
- end
-end
-
-
-if #arg ~= 2 then
- io.stderr:write('Usage: pdf2dsc input.pdf [output.dsc]\n')
- os.exit(1)
-end
-
-pdffile=arg[1]
-if #arg==2 then
- dscfile=arg[2]
-else
- dscfile=string.gsub(pdffile, '%.%a+$', '.dsc')
-end
-
--- setup command
-
-local command={}
-if os.type == 'unix' then command={'gs'} else command={'gswin32c'} end
-
---[[ Add -dNOSAFER again since pdf2dsc does not work without it.
- Use pdf2dsc for trusted sources only.
---]]
-
-push(command, '-q', '-dNODISPLAY', '-dALLOWPSTRANSPARENCY', '-dNOSAFER',
- '-sPDFname='..pdffile, '-sDSCname='..dscfile, 'pdf2dsc.ps',
- '-c', 'quit')
-
-command=fixwin(command)
-
---[[ prepend an additional hyphen to activate this code
-for i=0, #command do
- print (command[i])
-end
-os.exit(0)
---]]
-
-ret=os.spawn(command)
-os.exit(ret)
diff --git a/Master/texmf-dist/scripts/tlgs/gswin32/pdfopt.tlu b/Master/texmf-dist/scripts/tlgs/gswin32/pdfopt.tlu
deleted file mode 100755
index 5d7aa9de2f2..00000000000
--- a/Master/texmf-dist/scripts/tlgs/gswin32/pdfopt.tlu
+++ /dev/null
@@ -1,165 +0,0 @@
-#!/usr/bin/env texlua
---*-Lua-*-
--- $Id$
-
--- Copyright (C) 2008-2015 Reinhard Kotucha.
--- You may freely use, modify and/or distribute this file.
-
--- Generic wrapper for ps2pdf{,12,13,14} and pdfopt.
-
-
-local function usage (progname)
- local message=
- 'Usage: '..progname..' [options] <inputfile> <outputfile>\n\n'..
- ' <inputfile> can be either a PS, EPS, or PDF file.\n'..
- ' A single hyphen (-) denotes stdin.\n\n'..
- ' <outputfile> is required if <inputfile> is a PDF file\n'..
- ' or input is read from stdin.\n'
- return message
-end
-
-
-local function fixwin (args_unix)
- if os.type == 'windows' then
- local args_win={} -- new table
- args_win[0]=args_unix[1]
- for i=1, #args_unix do
- args_win[i]='"'..args_unix[i]..'"'
- end
- return args_win
- else
- return args_unix
- end
-end
-
-
-local function push (t, ...)
- local args={...}
- for _,v in ipairs(args) do
- if type(v) == 'table' then
- for _,x in ipairs(v) do
- t[#t+1]=x
- end
- else
- t[#t+1]=v
- end
- end
-end
-
-
-local function filename (file)
- -- strip path
- if string.find(file, '[/\\]') then
- return string.match(file, '.*[/\\](.*)$')
- else
- return file
- end
-end
-
-
-local function basename (file)
- -- strip extension
- return string.match(filename(file), '(.*)%..*')
-end
-
-
-local function extension (file)
- -- return extension if available, false otherwise.
- local fn=filename(file)
- if fn:find('%.') then
- return string.match(fn, '.*%.(.*)')
- end
-end
-
-
-local function parse_cmdline ()
- local files={}
- local options={}
-
- local progname
- local basename=filename(arg[0])
- if basename:find('%.') then
- progname=basename:match('(.*)%..*')
- else
- progname=basename
- end
-
- for i=1, #arg do
- if string.find(arg[i], '^%-.+') then
- push(options, arg[i])
- else
- push(files, arg[i])
- end
- end
- files.input =files[1]
- files.output=files[2]
- return progname, options, files
-end
-
-
-local function check_files (progname, files, default_output_ext)
- if #files < 1 then
- io.stderr:write(usage(progname))
- os.exit(1)
- end
-
- if #files < 2 then
- if extension(files.input) then
- local ext=string.lower(extension(files.input))
- if ext:match(default_output_ext..'$') then
- io.stderr:write('!Error: no output file specified.\n\n')
- io.stderr:write(usage(progname))
- os.exit(1)
- else
- files.output=basename(files.input)..'.'..default_output_ext
- end
- else -- the input file has no extension
- files.output=files.input..'.'..default_output_ext
- end
- end
-end
-
--- main --
-
--- parse command line
-local progname, options, file=parse_cmdline()
-
-check_files(progname, file, 'pdf')
-
--- determine PDF level
-local PDF_level='1.4' -- default, may be changed in the future
-if progname == 'ps2pdf12' then PDF_level='1.2'
-elseif progname == 'ps2pdf13' then PDF_level='1.3'
-elseif progname == 'ps2pdf14' then PDF_level='1.4'
-end
-
--- setup command
-
-local command={}
-if os.type == 'unix' then command={'gs'} else command={'gswin32c'} end
-
-push(command, '-P-', '-dALLOWPSTRANSPARENCY', options, '-dCompatibilityLevel='..PDF_level)
-
-if progname == 'pdfopt' then push(command, '-dFastWebView=true') end
-
-push(command, '-q', '-P-', '-dNOPAUSE', '-dBATCH', '-sDEVICE=pdfwrite')
-
-if os.type == 'unix' then push(command, '-sstdout=%stderr') end
-
-push(command, '-sOutputFile='..file.output, '-P-', '-dSAFER')
-
--- We have to include the options twice because -I only takes effect
--- if it appears before other options [see ps2pdfwr].
-push(command, options, '-f', file.input)
-
-command=fixwin(command)
-
---[[ prepend an additional hyphen to activate this code
-for i=0, #command do
- print (command[i])
-end
-os.exit(0)
---]]
-
-ret=os.spawn(command)
-os.exit(ret)
diff --git a/Master/texmf-dist/scripts/tlgs/gswin32/ps2ascii.tlu b/Master/texmf-dist/scripts/tlgs/gswin32/ps2ascii.tlu
deleted file mode 100755
index b97ad80c90c..00000000000
--- a/Master/texmf-dist/scripts/tlgs/gswin32/ps2ascii.tlu
+++ /dev/null
@@ -1,128 +0,0 @@
-#!/usr/bin/env texlua
---*-Lua-*-
--- $Id$
-
--- Copyright (C) 2008-2015 Reinhard Kotucha.
--- You may freely use, modify and/or distribute this file.
-
--- Replacement for ps2ascii.bat.
-
--- Extract ASCII text from a PostScript file. Usage:
---
--- ps2ascii [infile.ps [outfile.txt]]
---
--- If outfile is omitted, output goes to stdout.
--- If both infile and outfile are omitted, ps2ascii acts as a filter,
--- reading from stdin and writing on stdout.
-
-
--- We have to pass the command as a string to os.execute() because we
--- need a shell for i/o-redirection. But we create a table first and
--- convert it to a string, just to make sure we don't miss any spaces.
-
-local function push (t, ...)
- local args={...}
- for _,v in ipairs(args) do
- if type(v) == 'table' then
- for _,x in ipairs(v) do
- t[#t+1]=x
- end
- else
- t[#t+1]=v
- end
- end
-end
-
-
-local function filename (file)
- -- strip path
- if string.find(file, '[/\\]') then
- return string.match(file, '.*[/\\](.*)$')
- else
- return file
- end
-end
-
-
-local function remove_tmpfiles (tmpfiles)
- -- The shell script contains
- --
- -- trap "rm -f _temp_.err _temp_.out" 0 1 2 15
- --
- -- texlua doesn't support signals (yet). So we remove temporary files
- -- if possible.
- for i=1, #tmpfiles do
- if lfs.isfile(tmpfiles[i]) then
- os.remove(tmpfiles[i])
- end
- end
-end
-
-
-local function parse_cmdline ()
- local files={}
- local options={}
-
- local progname
- local basename=filename(arg[0])
- if basename:find('%.') then
- progname=basename:match('(.*)%..*')
- else
- progname=basename
- end
-
- for i=1, #arg do
- if string.find(arg[i], '^%-.+') then
- push(options, arg[i])
- else
- push(files, arg[i])
- end
- end
- files.input =files[1]
- files.output=files[2]
- return progname, options, files
-end
-
-
--- main --
-
-local progname, options, files=parse_cmdline ()
-
--- setup command
-
-local command={gs}
-if os.type == 'unix' then command={'gs'} else command={'gswin32c'} end
-
-push(command, {'-q', '-dNODISPLAY', '-P-', '-dALLOWPSTRANSPARENCY', '-dDELAYBIND',
- '-dWRITESYSTEMDICT', '-dSIMPLE'})
-
-push(command, '-c', 'save', '-f', 'ps2ascii.ps')
-
-if #files == 0 then
- push(command, '-')
-else
- push(command, '"'..files.input..'"')
-end
-
-push(command, '-c', 'quit')
-
-if #files > 1 then
- push(command, '>', '"'..files.output..'"')
-end
-
-local cmd_string=table.concat(command, ' ')
-
---[[ prepend an additional hyphen to activate this code
-print(cmd_string)
-os.exit(0)
---]]
-
-ret=os.execute(cmd_string)
-
--- The last character of the ASCII file is a form feed (^L).
--- Uncomment the following line if this confuses your terminal.
---
--- if #files < 2 then io.stdout:write('\r') end
-
-remove_tmpfiles{'_temp_.err', '_temp_.out'}
-os.exit(ret)
diff --git a/Master/texmf-dist/scripts/tlgs/gswin32/ps2pdf.tlu b/Master/texmf-dist/scripts/tlgs/gswin32/ps2pdf.tlu
deleted file mode 100755
index 64065fab3c6..00000000000
--- a/Master/texmf-dist/scripts/tlgs/gswin32/ps2pdf.tlu
+++ /dev/null
@@ -1,165 +0,0 @@
-#!/usr/bin/env texlua
---*-Lua-*-
--- $Id$
-
--- Copyright (C) 2008-2015 Reinhard Kotucha.
--- You may freely use, modify and/or distribute this file.
-
--- Generic wrapper for ps2pdf{,12,13,14} and pdfopt.
-
-
-local function usage (progname)
- local message=
- 'Usage: '..progname..' [options] <inputfile> <outputfile>\n\n'..
- ' <inputfile> can be either a PS, EPS, or PDF file.\n'..
- ' A single hyphen (-) denotes stdin.\n\n'..
- ' <outputfile> is required if <inputfile> is a PDF file\n'..
- ' or input is read from stdin.\n'
- return message
-end
-
-
-local function fixwin (args_unix)
- if os.type == 'windows' then
- local args_win={} -- new table
- args_win[0]=args_unix[1]
- for i=1, #args_unix do
- args_win[i]='"'..args_unix[i]..'"'
- end
- return args_win
- else
- return args_unix
- end
-end
-
-
-local function push (t, ...)
- local args={...}
- for _,v in ipairs(args) do
- if type(v) == 'table' then
- for _,x in ipairs(v) do
- t[#t+1]=x
- end
- else
- t[#t+1]=v
- end
- end
-end
-
-
-local function filename (file)
- -- strip path
- if string.find(file, '[/\\]') then
- return string.match(file, '.*[/\\](.*)$')
- else
- return file
- end
-end
-
-
-local function basename (file)
- -- strip extension
- return string.match(filename(file), '(.*)%..*')
-end
-
-
-local function extension (file)
- -- return extension if available, false otherwise.
- local fn=filename(file)
- if fn:find('%.') then
- return string.match(fn, '.*%.(.*)')
- end
-end
-
-
-local function parse_cmdline ()
- local files={}
- local options={}
-
- local progname
- local basename=filename(arg[0])
- if basename:find('%.') then
- progname=basename:match('(.*)%..*')
- else
- progname=basename
- end
-
- for i=1, #arg do
- if string.find(arg[i], '^%-.+') then
- push(options, arg[i])
- else
- push(files, arg[i])
- end
- end
- files.input =files[1]
- files.output=files[2]
- return progname, options, files
-end
-
-
-local function check_files (progname, files, default_output_ext)
- if #files < 1 then
- io.stderr:write(usage(progname))
- os.exit(1)
- end
-
- if #files < 2 then
- if extension(files.input) then
- local ext=string.lower(extension(files.input))
- if ext:match(default_output_ext..'$') then
- io.stderr:write('!Error: no output file specified.\n\n')
- io.stderr:write(usage(progname))
- os.exit(1)
- else
- files.output=basename(files.input)..'.'..default_output_ext
- end
- else -- the input file has no extension
- files.output=files.input..'.'..default_output_ext
- end
- end
-end
-
--- main --
-
--- parse command line
-local progname, options, file=parse_cmdline()
-
-check_files(progname, file, 'pdf')
-
--- determine PDF level
-local PDF_level='1.5' -- default, may be changed in the future
-if progname == 'ps2pdf12' then PDF_level='1.2'
-elseif progname == 'ps2pdf13' then PDF_level='1.3'
-elseif progname == 'ps2pdf14' then PDF_level='1.4'
-end
-
--- setup command
-
-local command={}
-if os.type == 'unix' then command={'gs'} else command={'gswin32c'} end
-
-push(command, '-P-', '-dALLOWPSTRANSPARENCY', options, '-dCompatibilityLevel='..PDF_level)
-
-if progname == 'pdfopt' then push(command, '-dFastWebView=true') end
-
-push(command, '-q', '-P-', '-dNOPAUSE', '-dBATCH', '-sDEVICE=pdfwrite')
-
-if os.type == 'unix' then push(command, '-sstdout=%stderr') end
-
-push(command, '-sOutputFile='..file.output, '-P-', '-dSAFER')
-
--- We have to include the options twice because -I only takes effect
--- if it appears before other options [see ps2pdfwr].
-push(command, options, '-f', file.input)
-
-command=fixwin(command)
-
---[[ prepend an additional hyphen to activate this code
-for i=0, #command do
- print (command[i])
-end
-os.exit(0)
---]]
-
-ret=os.spawn(command)
-os.exit(ret)
diff --git a/Master/texmf-dist/scripts/tlgs/gswin32/ps2pdf12.tlu b/Master/texmf-dist/scripts/tlgs/gswin32/ps2pdf12.tlu
deleted file mode 100755
index 64065fab3c6..00000000000
--- a/Master/texmf-dist/scripts/tlgs/gswin32/ps2pdf12.tlu
+++ /dev/null
@@ -1,165 +0,0 @@
-#!/usr/bin/env texlua
---*-Lua-*-
--- $Id$
-
--- Copyright (C) 2008-2015 Reinhard Kotucha.
--- You may freely use, modify and/or distribute this file.
-
--- Generic wrapper for ps2pdf{,12,13,14} and pdfopt.
-
-
-local function usage (progname)
- local message=
- 'Usage: '..progname..' [options] <inputfile> <outputfile>\n\n'..
- ' <inputfile> can be either a PS, EPS, or PDF file.\n'..
- ' A single hyphen (-) denotes stdin.\n\n'..
- ' <outputfile> is required if <inputfile> is a PDF file\n'..
- ' or input is read from stdin.\n'
- return message
-end
-
-
-local function fixwin (args_unix)
- if os.type == 'windows' then
- local args_win={} -- new table
- args_win[0]=args_unix[1]
- for i=1, #args_unix do
- args_win[i]='"'..args_unix[i]..'"'
- end
- return args_win
- else
- return args_unix
- end
-end
-
-
-local function push (t, ...)
- local args={...}
- for _,v in ipairs(args) do
- if type(v) == 'table' then
- for _,x in ipairs(v) do
- t[#t+1]=x
- end
- else
- t[#t+1]=v
- end
- end
-end
-
-
-local function filename (file)
- -- strip path
- if string.find(file, '[/\\]') then
- return string.match(file, '.*[/\\](.*)$')
- else
- return file
- end
-end
-
-
-local function basename (file)
- -- strip extension
- return string.match(filename(file), '(.*)%..*')
-end
-
-
-local function extension (file)
- -- return extension if available, false otherwise.
- local fn=filename(file)
- if fn:find('%.') then
- return string.match(fn, '.*%.(.*)')
- end
-end
-
-
-local function parse_cmdline ()
- local files={}
- local options={}
-
- local progname
- local basename=filename(arg[0])
- if basename:find('%.') then
- progname=basename:match('(.*)%..*')
- else
- progname=basename
- end
-
- for i=1, #arg do
- if string.find(arg[i], '^%-.+') then
- push(options, arg[i])
- else
- push(files, arg[i])
- end
- end
- files.input =files[1]
- files.output=files[2]
- return progname, options, files
-end
-
-
-local function check_files (progname, files, default_output_ext)
- if #files < 1 then
- io.stderr:write(usage(progname))
- os.exit(1)
- end
-
- if #files < 2 then
- if extension(files.input) then
- local ext=string.lower(extension(files.input))
- if ext:match(default_output_ext..'$') then
- io.stderr:write('!Error: no output file specified.\n\n')
- io.stderr:write(usage(progname))
- os.exit(1)
- else
- files.output=basename(files.input)..'.'..default_output_ext
- end
- else -- the input file has no extension
- files.output=files.input..'.'..default_output_ext
- end
- end
-end
-
--- main --
-
--- parse command line
-local progname, options, file=parse_cmdline()
-
-check_files(progname, file, 'pdf')
-
--- determine PDF level
-local PDF_level='1.5' -- default, may be changed in the future
-if progname == 'ps2pdf12' then PDF_level='1.2'
-elseif progname == 'ps2pdf13' then PDF_level='1.3'
-elseif progname == 'ps2pdf14' then PDF_level='1.4'
-end
-
--- setup command
-
-local command={}
-if os.type == 'unix' then command={'gs'} else command={'gswin32c'} end
-
-push(command, '-P-', '-dALLOWPSTRANSPARENCY', options, '-dCompatibilityLevel='..PDF_level)
-
-if progname == 'pdfopt' then push(command, '-dFastWebView=true') end
-
-push(command, '-q', '-P-', '-dNOPAUSE', '-dBATCH', '-sDEVICE=pdfwrite')
-
-if os.type == 'unix' then push(command, '-sstdout=%stderr') end
-
-push(command, '-sOutputFile='..file.output, '-P-', '-dSAFER')
-
--- We have to include the options twice because -I only takes effect
--- if it appears before other options [see ps2pdfwr].
-push(command, options, '-f', file.input)
-
-command=fixwin(command)
-
---[[ prepend an additional hyphen to activate this code
-for i=0, #command do
- print (command[i])
-end
-os.exit(0)
---]]
-
-ret=os.spawn(command)
-os.exit(ret)
diff --git a/Master/texmf-dist/scripts/tlgs/gswin32/ps2pdf13.tlu b/Master/texmf-dist/scripts/tlgs/gswin32/ps2pdf13.tlu
deleted file mode 100755
index 64065fab3c6..00000000000
--- a/Master/texmf-dist/scripts/tlgs/gswin32/ps2pdf13.tlu
+++ /dev/null
@@ -1,165 +0,0 @@
-#!/usr/bin/env texlua
---*-Lua-*-
--- $Id$
-
--- Copyright (C) 2008-2015 Reinhard Kotucha.
--- You may freely use, modify and/or distribute this file.
-
--- Generic wrapper for ps2pdf{,12,13,14} and pdfopt.
-
-
-local function usage (progname)
- local message=
- 'Usage: '..progname..' [options] <inputfile> <outputfile>\n\n'..
- ' <inputfile> can be either a PS, EPS, or PDF file.\n'..
- ' A single hyphen (-) denotes stdin.\n\n'..
- ' <outputfile> is required if <inputfile> is a PDF file\n'..
- ' or input is read from stdin.\n'
- return message
-end
-
-
-local function fixwin (args_unix)
- if os.type == 'windows' then
- local args_win={} -- new table
- args_win[0]=args_unix[1]
- for i=1, #args_unix do
- args_win[i]='"'..args_unix[i]..'"'
- end
- return args_win
- else
- return args_unix
- end
-end
-
-
-local function push (t, ...)
- local args={...}
- for _,v in ipairs(args) do
- if type(v) == 'table' then
- for _,x in ipairs(v) do
- t[#t+1]=x
- end
- else
- t[#t+1]=v
- end
- end
-end
-
-
-local function filename (file)
- -- strip path
- if string.find(file, '[/\\]') then
- return string.match(file, '.*[/\\](.*)$')
- else
- return file
- end
-end
-
-
-local function basename (file)
- -- strip extension
- return string.match(filename(file), '(.*)%..*')
-end
-
-
-local function extension (file)
- -- return extension if available, false otherwise.
- local fn=filename(file)
- if fn:find('%.') then
- return string.match(fn, '.*%.(.*)')
- end
-end
-
-
-local function parse_cmdline ()
- local files={}
- local options={}
-
- local progname
- local basename=filename(arg[0])
- if basename:find('%.') then
- progname=basename:match('(.*)%..*')
- else
- progname=basename
- end
-
- for i=1, #arg do
- if string.find(arg[i], '^%-.+') then
- push(options, arg[i])
- else
- push(files, arg[i])
- end
- end
- files.input =files[1]
- files.output=files[2]
- return progname, options, files
-end
-
-
-local function check_files (progname, files, default_output_ext)
- if #files < 1 then
- io.stderr:write(usage(progname))
- os.exit(1)
- end
-
- if #files < 2 then
- if extension(files.input) then
- local ext=string.lower(extension(files.input))
- if ext:match(default_output_ext..'$') then
- io.stderr:write('!Error: no output file specified.\n\n')
- io.stderr:write(usage(progname))
- os.exit(1)
- else
- files.output=basename(files.input)..'.'..default_output_ext
- end
- else -- the input file has no extension
- files.output=files.input..'.'..default_output_ext
- end
- end
-end
-
--- main --
-
--- parse command line
-local progname, options, file=parse_cmdline()
-
-check_files(progname, file, 'pdf')
-
--- determine PDF level
-local PDF_level='1.5' -- default, may be changed in the future
-if progname == 'ps2pdf12' then PDF_level='1.2'
-elseif progname == 'ps2pdf13' then PDF_level='1.3'
-elseif progname == 'ps2pdf14' then PDF_level='1.4'
-end
-
--- setup command
-
-local command={}
-if os.type == 'unix' then command={'gs'} else command={'gswin32c'} end
-
-push(command, '-P-', '-dALLOWPSTRANSPARENCY', options, '-dCompatibilityLevel='..PDF_level)
-
-if progname == 'pdfopt' then push(command, '-dFastWebView=true') end
-
-push(command, '-q', '-P-', '-dNOPAUSE', '-dBATCH', '-sDEVICE=pdfwrite')
-
-if os.type == 'unix' then push(command, '-sstdout=%stderr') end
-
-push(command, '-sOutputFile='..file.output, '-P-', '-dSAFER')
-
--- We have to include the options twice because -I only takes effect
--- if it appears before other options [see ps2pdfwr].
-push(command, options, '-f', file.input)
-
-command=fixwin(command)
-
---[[ prepend an additional hyphen to activate this code
-for i=0, #command do
- print (command[i])
-end
-os.exit(0)
---]]
-
-ret=os.spawn(command)
-os.exit(ret)
diff --git a/Master/texmf-dist/scripts/tlgs/gswin32/ps2pdf14.tlu b/Master/texmf-dist/scripts/tlgs/gswin32/ps2pdf14.tlu
deleted file mode 100755
index 64065fab3c6..00000000000
--- a/Master/texmf-dist/scripts/tlgs/gswin32/ps2pdf14.tlu
+++ /dev/null
@@ -1,165 +0,0 @@
-#!/usr/bin/env texlua
---*-Lua-*-
--- $Id$
-
--- Copyright (C) 2008-2015 Reinhard Kotucha.
--- You may freely use, modify and/or distribute this file.
-
--- Generic wrapper for ps2pdf{,12,13,14} and pdfopt.
-
-
-local function usage (progname)
- local message=
- 'Usage: '..progname..' [options] <inputfile> <outputfile>\n\n'..
- ' <inputfile> can be either a PS, EPS, or PDF file.\n'..
- ' A single hyphen (-) denotes stdin.\n\n'..
- ' <outputfile> is required if <inputfile> is a PDF file\n'..
- ' or input is read from stdin.\n'
- return message
-end
-
-
-local function fixwin (args_unix)
- if os.type == 'windows' then
- local args_win={} -- new table
- args_win[0]=args_unix[1]
- for i=1, #args_unix do
- args_win[i]='"'..args_unix[i]..'"'
- end
- return args_win
- else
- return args_unix
- end
-end
-
-
-local function push (t, ...)
- local args={...}
- for _,v in ipairs(args) do
- if type(v) == 'table' then
- for _,x in ipairs(v) do
- t[#t+1]=x
- end
- else
- t[#t+1]=v
- end
- end
-end
-
-
-local function filename (file)
- -- strip path
- if string.find(file, '[/\\]') then
- return string.match(file, '.*[/\\](.*)$')
- else
- return file
- end
-end
-
-
-local function basename (file)
- -- strip extension
- return string.match(filename(file), '(.*)%..*')
-end
-
-
-local function extension (file)
- -- return extension if available, false otherwise.
- local fn=filename(file)
- if fn:find('%.') then
- return string.match(fn, '.*%.(.*)')
- end
-end
-
-
-local function parse_cmdline ()
- local files={}
- local options={}
-
- local progname
- local basename=filename(arg[0])
- if basename:find('%.') then
- progname=basename:match('(.*)%..*')
- else
- progname=basename
- end
-
- for i=1, #arg do
- if string.find(arg[i], '^%-.+') then
- push(options, arg[i])
- else
- push(files, arg[i])
- end
- end
- files.input =files[1]
- files.output=files[2]
- return progname, options, files
-end
-
-
-local function check_files (progname, files, default_output_ext)
- if #files < 1 then
- io.stderr:write(usage(progname))
- os.exit(1)
- end
-
- if #files < 2 then
- if extension(files.input) then
- local ext=string.lower(extension(files.input))
- if ext:match(default_output_ext..'$') then
- io.stderr:write('!Error: no output file specified.\n\n')
- io.stderr:write(usage(progname))
- os.exit(1)
- else
- files.output=basename(files.input)..'.'..default_output_ext
- end
- else -- the input file has no extension
- files.output=files.input..'.'..default_output_ext
- end
- end
-end
-
--- main --
-
--- parse command line
-local progname, options, file=parse_cmdline()
-
-check_files(progname, file, 'pdf')
-
--- determine PDF level
-local PDF_level='1.5' -- default, may be changed in the future
-if progname == 'ps2pdf12' then PDF_level='1.2'
-elseif progname == 'ps2pdf13' then PDF_level='1.3'
-elseif progname == 'ps2pdf14' then PDF_level='1.4'
-end
-
--- setup command
-
-local command={}
-if os.type == 'unix' then command={'gs'} else command={'gswin32c'} end
-
-push(command, '-P-', '-dALLOWPSTRANSPARENCY', options, '-dCompatibilityLevel='..PDF_level)
-
-if progname == 'pdfopt' then push(command, '-dFastWebView=true') end
-
-push(command, '-q', '-P-', '-dNOPAUSE', '-dBATCH', '-sDEVICE=pdfwrite')
-
-if os.type == 'unix' then push(command, '-sstdout=%stderr') end
-
-push(command, '-sOutputFile='..file.output, '-P-', '-dSAFER')
-
--- We have to include the options twice because -I only takes effect
--- if it appears before other options [see ps2pdfwr].
-push(command, options, '-f', file.input)
-
-command=fixwin(command)
-
---[[ prepend an additional hyphen to activate this code
-for i=0, #command do
- print (command[i])
-end
-os.exit(0)
---]]
-
-ret=os.spawn(command)
-os.exit(ret)
diff --git a/Master/texmf-dist/scripts/tlgs/gswin32/ps2ps.tlu b/Master/texmf-dist/scripts/tlgs/gswin32/ps2ps.tlu
deleted file mode 100755
index e5e81a4b6f4..00000000000
--- a/Master/texmf-dist/scripts/tlgs/gswin32/ps2ps.tlu
+++ /dev/null
@@ -1,139 +0,0 @@
-#!/usr/bin/env texlua
---*-Lua-*-
--- $Id$
-
--- Copyright (C) 2010 Reinhard Kotucha.
--- You may freely use, modify and/or distribute this file.
-
--- Replacement for ps2ps2.bat.
--- Converting PostScript 3 or PDF into PostScript 2 with the
--- Ghostscript 'ps2write' device.
--- This generates a PDF-style stream with an attached
--- PostScript program to interpret it.
-
-
-local function usage (progname)
- local message=
- 'Usage: '..progname..' [options] <inputfile> <outputfile>\n\n'..
- ' <inputfile> can be either a PS, EPS, PDF file, or stdin.\n'..
- ' A single hyphen (-) denotes stdin.\n'
- return message
-end
-
-
-function fixwin(args_unix)
- if os.type == 'windows' then
- local args_win={} -- new table
- args_win[0]=args_unix[1]
- for i=1, #args_unix do
- args_win[i]='"'..args_unix[i]..'"'
- end
- return args_win
- else
- return args_unix
- end
-end
-
-
-local function push (t, ...)
- local args={...}
- for _,v in ipairs(args) do
- if type(v) == 'table' then
- for _,x in ipairs(v) do
- t[#t+1]=x
- end
- else
- t[#t+1]=v
- end
- end
-end
-
-
-local function filename (file)
- -- strip path
- if string.find(file, '[/\\]') then
- return string.match(file, '.*[/\\](.*)$')
- else
- return file
- end
-end
-
-
-local function basename (file)
- -- strip extension
- return string.match(filename(file), '(.*)%..*')
-end
-
-
-local function extension (file)
- -- return extension if available, false otherwise.
- local fn=filename(file)
- if fn:find('%.') then
- return string.match(fn, '.*%.(.*)')
- end
-end
-
-
-local function parse_cmdline ()
- local files={}
- local options={}
-
- local progname
- local basename=filename(arg[0])
- if basename:find('%.') then
- progname=basename:match('(.*)%..*')
- else
- progname=basename
- end
-
- for i=1, #arg do
- if string.find(arg[i], '^%-.+') then
- push(options, arg[i])
- else
- push(files, arg[i])
- end
- end
- files.input =files[1]
- files.output=files[2]
-
- return progname, options, files
-end
-
-
-local function check_files (progname, files)
- if #files < 2 then
- io.stderr:write(usage(progname))
- os.exit(1)
- end
-end
-
--- main --
-
-local progname, options, file=parse_cmdline()
-
-check_files (progname, file)
-
--- setup command
-
-local command={}
-if os.type == 'unix' then command={'gs'} else command={'gswin32c'} end
-
-push(command, '-q', '-sDEVICE=ps2write')
-
-if os.type=='unix' then push(command, '-sstdout=%stderr') end
-
-push(command, '-sOutputFile='..file.output)
-push(command, '-dNOPAUSE', '-dBATCH', '-P-', '-dALLOWPSTRANSPARENCY')
-push(command, options, file.input)
-
-command=fixwin(command)
-
---[[ prepend an additional hyphen to activate this code
-for i=0, #command do
- print (command[i])
-end
-os.exit(0)
---]]
-
-ret=os.spawn(command)
-os.exit(ret)
diff --git a/Master/texmf-dist/scripts/tlgs/pdf2dsc.lua b/Master/texmf-dist/scripts/tlgs/pdf2dsc.lua
new file mode 100755
index 00000000000..b69163939cd
--- /dev/null
+++ b/Master/texmf-dist/scripts/tlgs/pdf2dsc.lua
@@ -0,0 +1,36 @@
+#!/usr/bin/env texlua
+--*-Lua-*-
+-- $Id$
+
+-- Copyright (C) 2007-2022 Reinhard Kotucha.
+-- You may freely use, modify and/or distribute this file.
+
+doc = {
+ invocation = '[options] <inputfile> [<outputfile>]',
+ synopsis = 'Extract DSCs from PDF files',
+ details = [=[
+ <inputfile> is a PDF file. <outputfile> is a DSC file.
+]=]}
+
+default_outfile_ext = '.dsc'
+
+dofile(arg[0]:match('(.*[/\\]).*$')..'tlgs-common')
+
+local command = {gsname()}
+
+addto(command,
+ '-dDELAYSAFER',
+ '-dNODISPLAY',
+ '-sPDFname='..file.input,
+ '-sDSCname='..file.output,
+ 'pdf2dsc.ps')
+
+execute(command)
+
+-- Local Variables:
+-- mode: Lua
+-- lua-indent-level: 2
+-- indent-tabs-mode: nil
+-- coding: utf-8-unix
+-- End:
+-- vim:set tabstop=2 expandtab:
diff --git a/Master/texmf-dist/scripts/tlgs/pdf2ps.lua b/Master/texmf-dist/scripts/tlgs/pdf2ps.lua
new file mode 100755
index 00000000000..b1fbb163008
--- /dev/null
+++ b/Master/texmf-dist/scripts/tlgs/pdf2ps.lua
@@ -0,0 +1,45 @@
+#!/usr/bin/env texlua
+--*-Lua-*-
+-- $Id$
+
+-- Copyright (C) 2008-2022 Reinhard Kotucha.
+-- You may freely use, modify and/or distribute this file.
+
+doc = {
+ invocation = '[options] <inputfile> [<outputfile>]',
+ synopsis = 'Convert PDF tlo PostScript level 2.',
+ details = [=[
+ <inputfile> is a PDF file. A single hyphen (-) denotes stdin.
+
+ <outputfile> is required if <inputfile> is a PDF file
+ or input is read from stdin.
+]=]}
+
+default_outfile_ext = '.ps'
+
+dofile(arg[0]:match('(.*[/\\])')..'tlgs-common')
+
+local command = {gsname()}
+
+-- Doing an initial 'save' helps keep fonts from being flushed between pages.
+
+addto(command,
+ '-sDEVICE=ps2write',
+ '-o'..file.output,
+ options,
+ '-c',
+ 'save',
+ 'pop',
+ '-f',
+ file.input)
+
+execute(command)
+
+-- Local Variables:
+-- mode: Lua
+-- lua-indent-level: 2
+-- indent-tabs-mode: nil
+-- coding: utf-8-unix
+-- End:
+-- vim:set tabstop=2 expandtab:
+
diff --git a/Master/texmf-dist/scripts/tlgs/pdfopt.lua b/Master/texmf-dist/scripts/tlgs/pdfopt.lua
new file mode 100755
index 00000000000..41c8133ae6c
--- /dev/null
+++ b/Master/texmf-dist/scripts/tlgs/pdfopt.lua
@@ -0,0 +1,47 @@
+#!/usr/bin/env texlua
+--*-Lua-*-
+-- $Id$
+
+-- Copyright (C) 2008-2022 Reinhard Kotucha.
+-- You may freely use, modify and/or distribute this file.
+
+doc = {
+ invocation = '[options] <inputfile> [<outputfile>]',
+ synopsis = 'Create a PDF file for FastWebView.',
+ details = [=[
+ <inputfile> can be either a PS, EPS, or PDF file.
+ A single hyphen (-) denotes stdin.
+
+ <outputfile> is required if <inputfile> is a PDF file
+ or input is read from stdin.
+
+ Please note that PDF versions newer than 1.4 don't support
+ FastWebView any more. Thus we set -dCompatibilityLevel=1.4
+]=]}
+
+default_outfile_ext = '.pdf'
+
+dofile(arg[0]:match('(.*[/\\])')..'tlgs-common')
+
+local command = {gsname()}
+
+addto(command,
+ '-dFastWebView=true',
+ '-sDEVICE=pdfwrite',
+ '-dCompatibilityLevel=1.4',
+ '-o'..file.output,
+ options,
+ '-f',
+ file.input)
+
+execute(command)
+
+
+-- Local Variables:
+-- mode: Lua
+-- lua-indent-level: 2
+-- indent-tabs-mode: nil
+-- coding: utf-8-unix
+-- End:
+-- vim:set tabstop=2 expandtab:
+
diff --git a/Master/texmf-dist/scripts/tlgs/ps2ascii.lua b/Master/texmf-dist/scripts/tlgs/ps2ascii.lua
new file mode 100755
index 00000000000..1ce443895cd
--- /dev/null
+++ b/Master/texmf-dist/scripts/tlgs/ps2ascii.lua
@@ -0,0 +1,39 @@
+#!/usr/bin/env texlua
+--*-Lua-*-
+-- $Id$
+
+-- Copyright (C) 2008-2022 Reinhard Kotucha.
+-- You may freely use, modify and/or distribute this file.
+
+doc = {
+ invocation = '[options] <inputfile> <outputfile>',
+ synopsis = 'Extract ASCII text from a PostScript file.',
+ details = [=[
+ <inputfile> can be either a PS or PDF file. A single hyphen (-)
+ denotes stdin.
+
+ <outputfile> contains plain text. A single hyphen (-) denotes stdout.
+]=]}
+
+default_outfile_ext = '.txt'
+
+dofile(arg[0]:match('(.*[/\\]).*$')..'tlgs-common')
+
+local command = {gsname()}
+
+addto(command,
+ '-sDEVICE=txtwrite',
+ '-o'..file.output,
+ '-f',
+ file.input
+)
+
+execute(command)
+
+-- Local Variables:
+-- mode: Lua
+-- lua-indent-level: 2
+-- indent-tabs-mode: nil
+-- coding: utf-8-unix
+-- End:
+-- vim:set tabstop=2 expandtab:
diff --git a/Master/texmf-dist/scripts/tlgs/ps2pdf.lua b/Master/texmf-dist/scripts/tlgs/ps2pdf.lua
new file mode 100755
index 00000000000..190783493b8
--- /dev/null
+++ b/Master/texmf-dist/scripts/tlgs/ps2pdf.lua
@@ -0,0 +1,43 @@
+#!/usr/bin/env texlua
+--*-Lua-*-
+-- $Id$
+
+-- Copyright (C) 2008-2022 Reinhard Kotucha.
+-- You may freely use, modify and/or distribute this file.
+
+doc = {
+ invocation = '[options] <inputfile> [<outputfile>]',
+ synopsis = 'Convert PostScript to PDF version @PDF_level@.',
+ details = [=[
+ <inputfile> can be either a PS, EPS, or PDF file.
+ A single hyphen (-) denotes stdin.
+
+ <outputfile> is required if <inputfile> is a PDF file
+ or input is read from stdin.
+]=]}
+
+default_outfile_ext = '.pdf'
+
+dofile(arg[0]:match('(.*[/\\])')..'tlgs-common')
+
+local command = {gsname()}
+
+addto(command,
+ '-sDEVICE=pdfwrite',
+ '-dCompatibilityLevel='..PDF_level(progname),
+ '-o'..file.output,
+ options,
+ '-f',
+ file.input)
+
+execute(command)
+
+
+-- Local Variables:
+-- mode: Lua
+-- lua-indent-level: 2
+-- indent-tabs-mode: nil
+-- coding: utf-8-unix
+-- End:
+-- vim:set tabstop=2 expandtab:
+
diff --git a/Master/texmf-dist/scripts/tlgs/ps2pdf12.lua b/Master/texmf-dist/scripts/tlgs/ps2pdf12.lua
new file mode 100755
index 00000000000..190783493b8
--- /dev/null
+++ b/Master/texmf-dist/scripts/tlgs/ps2pdf12.lua
@@ -0,0 +1,43 @@
+#!/usr/bin/env texlua
+--*-Lua-*-
+-- $Id$
+
+-- Copyright (C) 2008-2022 Reinhard Kotucha.
+-- You may freely use, modify and/or distribute this file.
+
+doc = {
+ invocation = '[options] <inputfile> [<outputfile>]',
+ synopsis = 'Convert PostScript to PDF version @PDF_level@.',
+ details = [=[
+ <inputfile> can be either a PS, EPS, or PDF file.
+ A single hyphen (-) denotes stdin.
+
+ <outputfile> is required if <inputfile> is a PDF file
+ or input is read from stdin.
+]=]}
+
+default_outfile_ext = '.pdf'
+
+dofile(arg[0]:match('(.*[/\\])')..'tlgs-common')
+
+local command = {gsname()}
+
+addto(command,
+ '-sDEVICE=pdfwrite',
+ '-dCompatibilityLevel='..PDF_level(progname),
+ '-o'..file.output,
+ options,
+ '-f',
+ file.input)
+
+execute(command)
+
+
+-- Local Variables:
+-- mode: Lua
+-- lua-indent-level: 2
+-- indent-tabs-mode: nil
+-- coding: utf-8-unix
+-- End:
+-- vim:set tabstop=2 expandtab:
+
diff --git a/Master/texmf-dist/scripts/tlgs/ps2pdf13.lua b/Master/texmf-dist/scripts/tlgs/ps2pdf13.lua
new file mode 100755
index 00000000000..190783493b8
--- /dev/null
+++ b/Master/texmf-dist/scripts/tlgs/ps2pdf13.lua
@@ -0,0 +1,43 @@
+#!/usr/bin/env texlua
+--*-Lua-*-
+-- $Id$
+
+-- Copyright (C) 2008-2022 Reinhard Kotucha.
+-- You may freely use, modify and/or distribute this file.
+
+doc = {
+ invocation = '[options] <inputfile> [<outputfile>]',
+ synopsis = 'Convert PostScript to PDF version @PDF_level@.',
+ details = [=[
+ <inputfile> can be either a PS, EPS, or PDF file.
+ A single hyphen (-) denotes stdin.
+
+ <outputfile> is required if <inputfile> is a PDF file
+ or input is read from stdin.
+]=]}
+
+default_outfile_ext = '.pdf'
+
+dofile(arg[0]:match('(.*[/\\])')..'tlgs-common')
+
+local command = {gsname()}
+
+addto(command,
+ '-sDEVICE=pdfwrite',
+ '-dCompatibilityLevel='..PDF_level(progname),
+ '-o'..file.output,
+ options,
+ '-f',
+ file.input)
+
+execute(command)
+
+
+-- Local Variables:
+-- mode: Lua
+-- lua-indent-level: 2
+-- indent-tabs-mode: nil
+-- coding: utf-8-unix
+-- End:
+-- vim:set tabstop=2 expandtab:
+
diff --git a/Master/texmf-dist/scripts/tlgs/ps2pdf14.lua b/Master/texmf-dist/scripts/tlgs/ps2pdf14.lua
new file mode 100755
index 00000000000..190783493b8
--- /dev/null
+++ b/Master/texmf-dist/scripts/tlgs/ps2pdf14.lua
@@ -0,0 +1,43 @@
+#!/usr/bin/env texlua
+--*-Lua-*-
+-- $Id$
+
+-- Copyright (C) 2008-2022 Reinhard Kotucha.
+-- You may freely use, modify and/or distribute this file.
+
+doc = {
+ invocation = '[options] <inputfile> [<outputfile>]',
+ synopsis = 'Convert PostScript to PDF version @PDF_level@.',
+ details = [=[
+ <inputfile> can be either a PS, EPS, or PDF file.
+ A single hyphen (-) denotes stdin.
+
+ <outputfile> is required if <inputfile> is a PDF file
+ or input is read from stdin.
+]=]}
+
+default_outfile_ext = '.pdf'
+
+dofile(arg[0]:match('(.*[/\\])')..'tlgs-common')
+
+local command = {gsname()}
+
+addto(command,
+ '-sDEVICE=pdfwrite',
+ '-dCompatibilityLevel='..PDF_level(progname),
+ '-o'..file.output,
+ options,
+ '-f',
+ file.input)
+
+execute(command)
+
+
+-- Local Variables:
+-- mode: Lua
+-- lua-indent-level: 2
+-- indent-tabs-mode: nil
+-- coding: utf-8-unix
+-- End:
+-- vim:set tabstop=2 expandtab:
+
diff --git a/Master/texmf-dist/scripts/tlgs/ps2ps.lua b/Master/texmf-dist/scripts/tlgs/ps2ps.lua
new file mode 100755
index 00000000000..f25269127d1
--- /dev/null
+++ b/Master/texmf-dist/scripts/tlgs/ps2ps.lua
@@ -0,0 +1,39 @@
+#!/usr/bin/env texlua
+--*-Lua-*-
+-- $Id$
+
+-- Copyright (C) 2010-2022 Reinhard Kotucha.
+-- You may freely use, modify and/or distribute this file.
+
+doc = {
+ invocation = '[options] <inputfile> <outputfile>',
+ synopsis = 'Convert PDF or PS3 to PostScript Level 2',
+ details = [=[
+ <inputfile> can be either an EPS or PS file, or stdin.
+ A single hyphen (-) denotes stdin.
+
+ <outputfile> is a PostScript Level 2 file.
+ A single hyphen (-) denotes stdout.
+]=]}
+
+dofile(arg[0]:match('(.*[/\\]).*$')..'tlgs-common')
+
+local command = {gsname()}
+
+addto(command,
+ '-sDEVICE=ps2write',
+ '-o'..file.output,
+ options,
+ '-f',
+ file.input)
+
+execute(command)
+
+
+-- Local Variables:
+-- mode: Lua
+-- lua-indent-level: 2
+-- indent-tabs-mode: nil
+-- coding: utf-8-unix
+-- End:
+-- vim:set tabstop=2 expandtab:
diff --git a/Master/texmf-dist/scripts/tlgs/tlgs-common b/Master/texmf-dist/scripts/tlgs/tlgs-common
new file mode 100644
index 00000000000..df863f48e0e
--- /dev/null
+++ b/Master/texmf-dist/scripts/tlgs/tlgs-common
@@ -0,0 +1,329 @@
+
+-- $Id$
+
+-- Copyright (C) 2022 Reinhard Kotucha <reinhard.kotucha@web.de>
+--
+-- You may freely use, modify, and/or distribute this file.
+
+-- Note: This file can only be used by the scripts in the same directory and
+-- thus it's not executable on Unix and its name has no extension.
+
+--[===================================================================[
+
+Description
+===========
+
+This file contains functions used by the texlua scripts replacing the batch
+files for Windows. It also defines optional arguments shared by all
+scripts.
+
+The following features are supported by all scripts:
+
+ 1. If you invoke a script without any command-line argument a usage message
+ is printed to stdout.
+
+ 2. On Windows arguments with spaces are quoted automatically though they
+ are already passed to Ghostscript as a list. This is not necessary on
+ any other system.
+
+ 3. The scripts abort with an error message if the names of an input file
+ and an output file are identical. Please note that there is no way to
+ protect you if you read from stdin an/or write to stdout.
+
+ 4. The environment variable TLGS_SHOW_ARGV can be used for debugging.
+ More details below.
+
+
+Compatibility
+=============
+
+Batch files for Windows and shell scripts for Unix are provided as 3rd-party
+software by Artifex. They are quite different and not maintained for a long
+time.
+
+The texlua scripts in this package were derived from the Unix shell scripts.
+They are not fully compatible but supposed to behave identical on all
+systems supported by TeX Live.
+
+
+Using the scripts on Unix
+=========================
+
+In order to use the scripts on Unix, add /path/to/texmf-dist/scripts/tlgs to
+PATH. They have to be invoked with their full names, for instance ps2pdf.lua
+instead of ps2pdf.
+
+
+Debugging
+=========
+
+If the environment variable TLGS_SHOW_ARGV is set the scripts print to
+stderr how they would invoke Ghostscript without actually invoking GS.
+Arguments are separated by newline characters.
+
+In order to see how Ghostscript is invoked on another operating system
+just pass the system name as a value to TLGS_SHOW_ARGV.
+
+Only the first letter of the value is evaluated. 'U' and 'u' denote Unix
+and 'W' and 'w' denote Windows. To see on a Unix system how a script is
+invoked under Windows, set
+
+ TLGS_SHOW_ARGV=windows
+
+--]===================================================================]
+
+
+-- Strip path and extension from arg[0].
+progname = arg[0]:match('.*[/\\](.*)$')
+if progname:match('%.') then progname = progname:gsub('%..*', '') end
+
+
+function PDF_level (progname)
+ -- Associate PDF version number with programs.
+ level = {
+ ps2pdf = 1.5,
+ ps2pdf12 = 1.2,
+ ps2pdf13 = 1.3,
+ ps2pdf14 = 1.4,
+ pdfopt = 1.4, -- newer versions of PDF don't support FastWebView.
+ }
+ return level[progname]
+end
+
+
+local function msg (s, stream)
+ if stream == 1 then io.write(s) else io.stderr:write(s) end
+end
+
+
+local function indent (s)
+ -- Indent messages. Remove all leading spaces from each line and
+ -- add a well defined number of them instead. s can either be a
+ -- string with line breaks or a list of strings.
+
+ local indentlevel = 3
+ local lines
+
+ if type(s) == 'table' then
+ lines = s
+ else
+ lines = s:explode('\n')
+ end
+
+ for i=1, #lines do
+ lines[i] = lines[i]:gsub('^[\t ]*', '')
+ lines[i] = string.rep(' ', 3)..lines[i]
+ lines[i] = lines[i]:gsub('~', ' ')
+ end
+ return table.concat(lines, '\n')..'\n'
+end
+
+
+local function usage (progname, stream)
+ -- Print usage message. The message is written to stdout with exit
+ -- code 0 if no arguments are given and to stderr with exit code 1
+ -- if it's attached to an error message.
+
+ if not stream then stream = 2 end
+
+ local gsdoc = [===[
+ For optional arguments consult the Ghostscript documentation:
+
+ ~~~~https://ghostscript.readthedocs.io/en/gs<VERSION>/Use.html
+ ]===]
+
+ if doc.synopsis:match('@PDF_level@') then
+ doc.synopsis = doc.synopsis:gsub('@PDF_level@', PDF_level(progname))
+ end
+
+ msg('Usage:\n', stream)
+ msg(indent(progname .. ' ' .. doc.invocation..'\n'), stream)
+ msg(indent('Synopsis: '..doc.synopsis)..'\n', stream)
+ msg(indent(doc.details), stream)
+ msg(indent(gsdoc), stream)
+ os.exit(stream - 1)
+end
+
+
+local function errmsg (message)
+ io.stderr:write('!ERROR: '..message..'\n')
+ usage(progname, 2)
+end
+
+
+function gsname ()
+ -- Determine the name of the Ghostscript executable.
+
+ if os.getenv('TLGS_SHOW_ARGV_W') then
+ os.type = 'windows'
+ end
+
+ if os.type == 'windows' then
+ if os.getenv('PROCESSOR_ARCHITECTURE') == 'AMD64' or
+ os.getenv('PROCESSOR_ARCHITEW6432') == 'AMD64'
+ then
+ return 'gswin64c'
+ else
+ return 'gswin32c'
+ end
+ else
+ return 'gs'
+ end
+end
+
+
+function addto (t, ...)
+ -- Append elements to an ordered list (table with numeric indices).
+ -- An arbitrary number of arguments is allowed.
+ --
+ -- This function is used to collect command-line arguments (from the
+ -- arg array) and to assemble the command-line supposed to invoke
+ -- Ghostscript.
+
+ local args = {...}
+ for _,val in ipairs(args) do
+ if type(val) == 'table' then
+ for _,str in ipairs(val) do
+ t[#t+1] = str
+ end
+ else
+ t[#t+1] = val
+ end
+ end
+end
+
+
+local function replace_or_add_extension (filename, default_ext)
+ -- We have to consider the case that a directory name contains a dot
+ -- and the file name has no extesion.
+ local path = ''
+ local file
+
+ if filename:match('/') then -- filename has a path component
+ path, file = filename:match('(.*/)(.*)')
+ else -- no path component
+ file = filename
+ end
+
+ if file:match('%.') then -- has an extension, replace it
+ local basename = file:gsub('%..*', '')
+ file = basename .. default_ext
+ else -- no extension, add one
+ file = file .. default_ext
+ end
+
+ return file
+end
+
+
+function process_cmdline ()
+ -- Parse the argument vector and return the progname (arg[0]),
+ -- optional arguments (beginning with -) and filenames.
+
+ local options = {}
+ local file = {}
+
+ -- If no arguments are given at all abort with a usage message.
+ if #arg == 0 then usage(progname, 1) end
+
+ for i=1, #arg do
+ if string.find(arg[i], '^%-.+') then
+ addto(options, arg[i])
+ else
+ addto(file, arg[i])
+ end
+ end
+
+ file.input = file[1]:gsub('\\', '/')
+ if #file > 1 then file.output = file[2]:gsub('\\', '/') end
+
+ if #file < 2 then -- no output file specified
+ if default_outfile_ext then -- <outputfile> is optional
+ file.output = replace_or_add_extension(file.input, default_outfile_ext)
+ else -- <outputfile> is mandatory
+ errmsg('You have to specify <outputfile>.\n')
+ end
+ end
+
+ local stdio = false
+ if file.input:match('^%-$') or file.output:match('^%-$') then stdio = true end
+
+ if not stdio and file.input == file.output then
+ errmsg('<outputfile> has the same name as <inputfile>\n'..
+ indent{'<inputfile> = "'..file.input..'"',
+ '<outputfile> = "'..file.output..'"'})
+ end
+ return progname, options, file
+end
+
+
+function execute (command)
+ -- Pass the command line specified by "command" to Ghostscript.
+
+ -- We first prepend options common to all programs to the command
+ -- line. Some of them are obsolete nowadays but needed by older
+ -- versions of Ghostscript. They have to be specified in reverse
+ -- order.
+
+ -- Note: if -dNODISPLAY is set ps2pdf doesn't provide any output.
+ -- Thus we entirely depend on -dBATCH.
+
+ local common_opts = {
+ '-dALLOWPSTRANSPARENCY',
+ '-P-',
+ '-dSAFER',
+ '-dBATCH',
+ '-q' }
+
+ for _, opt in ipairs(common_opts) do
+ table.insert(command, 2, opt)
+ end
+
+ -- Windows converts the argument vector specified by execv*() to a
+ -- string and then back to a vector (argv). In order to support
+ -- spaces in filenames arguments with spaces have to be quoted
+ -- explicitly.
+
+ local function fixwindows (command)
+ for i=2, #command do
+ if command[i]:match('%s') then
+ command[i] = '"'..command[i]..'"'
+ end
+ command[i] = command[i]:gsub('%%', '%%%%')
+ end
+ return command
+ end
+
+ if os.getenv('TLGS_SHOW_ARGV') then
+ if os.getenv('TLGS_SHOW_ARGV'):match('^[Uu]') then os.type = 'unix' end
+ if os.getenv('TLGS_SHOW_ARGV'):match('^[Ww]') then os.type = 'windows' end
+ command[1] = gsname()
+ if os.type == 'windows' then command = fixwindows(command) end
+
+ -- We have to write to stderr because we don't get the desired result if
+ -- the test files use I/O redirection.
+
+ for i=1, #command do
+ io.stderr:write (command[i]..'\n')
+ end
+ os.exit(0)
+ end
+
+ if os.type == 'windows' then command = fixwindows(command) end
+ os.exit(os.spawn(command))
+end
+
+-- These variables are passed as global variables to the scripts.
+
+progname, options, file = process_cmdline()
+
+
+-- Local Variables:
+-- mode: Lua
+-- lua-indent-level: 2
+-- indent-tabs-mode: nil
+-- fill-column: 76
+-- coding: utf-8-unix
+-- End:
+-- vim:set tabstop=2 expandtab:
+
diff --git a/Master/tlpkg/tlpsrc/tlgs.win32.tlpsrc b/Master/tlpkg/tlpsrc/tlgs.win32.tlpsrc
index f590ede51b3..329eaedb71e 100644
--- a/Master/tlpkg/tlpsrc/tlgs.win32.tlpsrc
+++ b/Master/tlpkg/tlpsrc/tlgs.win32.tlpsrc
@@ -11,4 +11,4 @@ binpattern f/win32 bin/win32/ps2pdf12
binpattern f/win32 bin/win32/ps2pdf13
binpattern f/win32 bin/win32/ps2pdf14
binpattern f/win32 bin/win32/ps2ps
-binpattern f/win32 bin/win32/ps2ps2
+binpattern f/win32 bin/win32/pdf2ps