\Format pdf4 pdf "PDF (XeTeX)" X "%%" "" "document,vector,menu=export" ""
\Format pdf5 pdf "PDF (LuaTeX)" u "%%" "" "document,vector,menu=export" ""
\Format pdf6 pdf "PDF (graphics)" "" "%%" "" "vector" "application/pdf"
-\Format pdf7 pdf "PDF (cropped)" "" "%%" "" "document,menu=export" ""'''])
+\Format pdf7 pdf "PDF (cropped)" "" "%%" "" "document,vector,menu=export" ""
+\Format pdf8 pdf "PDF (150 dpi)" "" "%%" "" "document,vector,menu=export" ""'''])
#
checkViewer('a DVI previewer', ['xdvi', 'kdvi', 'okular', 'yap', 'dviout -Set=!m'],
rc_entry = [r'''\Format dvi dvi DVI D "%%" "" "document,vector,menu=export" "application/x-dvi"
# Only define a converter from pdf6 for graphics
checkProg('a PDF to EPS converter', ['pdftops -eps -f 1 -l 1 $$i $$o'],
rc_entry = [ r'\converter pdf6 eps "%%" ""' ])
- #
+ # Create one converter for a PDF produced using TeX fonts and one for a
+ # PDF produced using non-TeX fonts. This does not produce non-unique
+ # conversion paths, since a given document either uses TeX fonts or not.
checkProg('a PDF cropping tool', ['pdfcrop $$i $$o'],
- rc_entry = [ r'\converter pdf2 pdf7 "%%" ""' ])
+ rc_entry = [ r'''\converter pdf2 pdf7 "%%" ""
+\converter pdf4 pdf7 "%%" ""''' ])
+ # Create one converter for a PDF produced using TeX fonts and one for a
+ # PDF produced using non-TeX fonts. This does not produce non-unique
+ # conversion paths, since a given document either uses TeX fonts or not.
+ checkProg('Ghostscript', ["gswin32c", "gswin64c", "gs"],
+ rc_entry = [ r'''\converter pdf2 pdf8 "python -tt $$s/scripts/convert_pdf.py $$i $$o ebook" ""
+\converter pdf4 pdf8 "python -tt $$s/scripts/convert_pdf.py $$i $$o ebook" ""''' ])
#
checkProg('a Beamer info extractor', ['makebeamerinfo -p $$i'],
rc_entry = [ r'\converter pdf2 beamer.info "%%" ""' ])
--- /dev/null
+# -*- coding: utf-8 -*-
+
+# file convert_pdf.py
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING.
+
+# author Georg Baum
+# Full author contact details are available in file CREDITS
+
+# This script takes a PS or PDF file and creates a low resolution version.
+# Example usage:
+# convert_pdf.py big.pdf small.pdf ebook
+
+# This script takes three arguments:
+# INFILE: the name of the .ps or .pdf file to be converted.
+# OUTFILE: the name of the .pdf file to be created.
+# PDFSETTINGS: any PDFSETTINGS supported by ghostscript:
+
+
+import sys
+
+from lyxpreview_tools import error, find_exe_or_terminate, run_command
+
+
+def usage(prog_name):
+ return "Usage: %s <ps or pdf input file> <pdf output file> <screen|ebook|printer|prepress>" \
+ % prog_name
+
+
+def main(argv):
+
+ if len(argv) == 4:
+ source = argv[1]
+ output = argv[2]
+ pdfsettings = argv[3]
+ else:
+ error(usage(argv[0]))
+
+ gs = find_exe_or_terminate(["gswin32c", "gswin64c", "gs"])
+ gs_call = '%s -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite ' \
+ '-dCompatibilityLevel=1.4 -dPDFSETTINGS=/%s ' \
+ '-sOutputFile="%s" "%s"' % (gs, pdfsettings, output, source)
+
+ gs_status, gs_stdout = run_command(gs_call)
+ if gs_stdout:
+ sys.stdout.write(gs_stdout)
+ return gs_status
+
+
+if __name__ == "__main__":
+ sys.exit(main(sys.argv))