Meta-command convert, corresponding to script appy/pod/converter.py, allows to call LibreOffice in server mode to ask him to convert a input file to some supported output format.
As a prerequisite to launching this command, LibreOffice must run in server mode, as explained聽in this page (read section named Managing LibreOffice).
The following example asks LibreOffice to convert a DOCX file into PDF.
appy convert /home/convertor/Planning.docx pdf
That being said, in the majority of cases, the input file to convert is generally an ODT or ODS file.
On completion, file聽/home/convertor/Planning.pdf should exist.
Unfortunately, for Windows users, meta-command appy is not available yet. You have 2 options: the first and wiser option is start using Linux聽馃榿. The second is to determine paths to your Python interpreter and to appy/pod/converter.py, to produce a command that will look like this one.
C:\Program Files\Python312\python.exe C:\Users\Linus\Python\Python312\site-packages\appy\pod\converter.py C:\Users\Linus\fichier.docx pdf
Reference
All program options are documented hereafter.
Usage: appy convert fileToConvert output [options]
聽or 聽: python3 converter.py fileToConvert output [options]
聽
聽 聽"fileToConvert" is the absolute or relative pathname of the file you
聽 聽want to convert (or whose content like indexes need to be refreshed)
聽 聽
聽 聽"output" can be the output format, that must be one of:
聽 聽 聽 聽 聽 聽 odt, ods, odp, htm, html, rtf, txt, csv, pdf, swf, doc, xls, ppt, docx, xlsx
聽 聽 聽 聽 聽 聽 or can be the absolute path to the result file, whose extension must
聽 聽 聽 聽 聽 聽 correspond to a valid output format.
聽 聽The Python interpreter running this command must be UNO-enabled (ie, the one
聽 聽being included in the LibreOffice distribution).
聽
聽 聽LibreOffice must be running in server mode prior to running this command.
Options:
聽 -h, --help 聽 聽 聽 聽 聽 聽show this help message and exit
聽 -e SERVER, --server=SERVER
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 The server IP or hostname that runs LibreOffice
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 (defaults to "localhost").
聽 -p PORT, --port=PORT 聽The port on which LibreOffice runs (default is 2002).
聽 -t TEMPLATE, --template=TEMPLATE
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 The path to a LibreOffice template from which you may
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 import styles.
聽 -o OPTIMAL_COL_WIDTHS, --optimalColumnWidths=OPTIMAL_COL_WIDTHS
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 Set this option to "True" if you want LibreOffice to
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 optimize column widths for all tables included in the
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 document. Alternately, specify a regular expression:
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 only tables whose name match will be processed. And if
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 the expression starts with char "~", only tables not
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 matching it will be processed. WARNING - If, for some
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 table, columns are both required to be optimized
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 (parameter "optimalColumnWidths") and distributed
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 (parameter "distributeColumns", only optimization will
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 take place.
聽 -d DISTRIBUTE_COLUMNS, --distributeColumns=DISTRIBUTE_COLUMNS
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 Set this option to "True" if you want LibreOffice to
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 distribute columns evenly for all tables included in
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 the document. Alternately, specify a regular
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 expression: only tables whose name match will be
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 processed. And if the expression starts with char "~",
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 only tables not matching it will be processed. WARNING
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 - If, for some table, columns are both required to be
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 optimized (parameter "optimalColumnWidths") and
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 distributed (parameter "distributeColumns", only
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 optimization will take place.
聽 -r RESOLVE_FIELDS, --resolveFields=RESOLVE_FIELDS
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 Set this option to "True" if you want LibreOffice to
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 replace the content of fields by their values. It can
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 be useful, for instance, if the POD result must be
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 included in another document, but the total number of
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 pages must be kept as is. Set this option to
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 "PageCount" instead of "True" to update this field
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 only. Note that field "PageNumber" is never resolved,
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 whatever the value of the option, because its value is
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 different from one page to another.
聽 -s SCRIPT, --script=SCRIPT
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 You can specify here (the absolute path to) a Python
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 script containing functions that the converter will
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 call in order to customize the process of manipulating
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 the document via the LibreOffice UNO interface. The
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 following functions can be defined in your script and
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 must all accept a single parameter: the Converter
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 instance. ***updateTableOfContents***, if defined,
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 will be called for producing a custom table of
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 contents. At the time this function is called by the
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 converter, converter.toc will contain the table of
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 contents, already updated by LibreOffice.
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 ***finalize*** will be called at the end of the
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 process, just before saving the result.
聽 -v, --verbose 聽 聽 聽 聽 Writes more information on stdout.
聽 -f PDF_OPTIONS, --pdf=PDF_OPTIONS
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 If the output format is PDF, you can define here
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 conversion options, as a series of comma-separated
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 key=value pairs, as in
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 "ExportNotes=True,PageRange=1-20". Available options
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 are documented in https://wiki.openoffice.org/wiki/API
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 /Tutorials/PDF_export.
聽 -i CSV_OPTIONS, --csv=CSV_OPTIONS
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 If the ouput format is CSV, you can define here
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 conversion options, as a comma-separated list of
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 values. Default options are: 59,34,76,1.Values
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 correspond to ASCII codes. The first one represents
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 the field separator. The most frequent values are: 59
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 (the semi-colon ;), 44 (the comma ,) and 9 (a tab).
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 The second value represents the text delimiter. The
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 most frequent values are: 34 (double quotes), 39
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 (single quotes) or no value at all (as in 59,,76,1).
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 The third one is the file encoding. The most frequent
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 values are 76 (UTF-8) and 12 (ISO-8859-1). Complete
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 documentation about CSV options can be found at https:
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 //wiki.openoffice.org/wiki/Documentation/DevGuide/Spre
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 adsheets/Filter_Options#Filter_Options_for_the_CSV_Fil
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 ter.
聽 -c, --ppp 聽 聽 聽 聽 聽 聽 Enable the POD post-processor (PPP). The PPP is a
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 series of UNO commands that react to PPP instructions
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 encoded within object names and must be executed at
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 the end of the process, when all other tasks have been
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 performed on the document, just before converting it
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 to another format or saving it to disk or as a stream.
聽 -a STREAM, --stream=STREAM
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 By default (stream = "auto"), if you specify
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 "localhost" as server running LibreOffice, the
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 converter and LibreOffice will exchange the input and
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 result files via the disk. If you specify anything
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 else, the converter will consider that LibreOffice
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 runs on a distant server: input and result files will
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 be carried as streams via the network. If you want to
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 bypass this logic and force exchange as streams or
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 files on disk, set this option to "True" for stream or
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 "False" for disk. You may also specify "in" (the input
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 file is streamed and the result is written on disk) or
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 "out" (the input file is read on disk and the result
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 is streamed).
聽 -g PAGESTART, --pageStart=PAGESTART
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 Specify an integer number different from 1 and the
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 produced document's page numbering will start at this
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 number.