This file is indexed.

/usr/share/lyx/scripts/convert_pdf.py is in lyx-common 2.2.2-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# -*- 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))