UNOCONV

NAME

unoconv - convert any document from and to any LibreOffice supported format

SYNOPSIS

unoconv [options] file [file2 ..]

unoconv --listener [--server SRV] [--port PRT] [--connection CON]

DESCRIPTION

unoconv is a command line utility that can convert any file format that LibreOffice can import, to any file format that LibreOffice is capable of exporting.

unoconv uses the LibreOffice's UNO bindings for non-interactive conversion of documents and therefore needs an LibreOffice instance to communicate with. Therefore if it cannot find one, it will start its own instance for temporary usage. If desired, one can start a "listener" instance to use for subsequent connections or even for remote connections.

OPTIONS

-c, --connection

:UNO connection string to be used by the client to connect to an LibreOffice instance, or used by the listener to make LibreOffice listen.

:Specify the output format for the document. You can get a list of possible output formats per document type by using the --show option.

Default document type is 'pdf'.

-i, --import

:Set specific import filters options (related to the used LibreOffice import filter based on the input filename).

See the *IMPORT FILTERS* section.

-l, --listener

Start unoconv as listener for unoconv clients to connect to.

-n, --no-launch

By default if no listener is running, unoconv will launch its own (temporary) listener to make sure the conversion works. This option will abort the conversion if no listener is found, rather than starting our own listener.

-o, --output

If the argument is a directory, put the converted documents in this directory. If multiple input files are provided, use it as a basename (and add output extension). Otherwise use it as the output filename.

--pipe

Use a pipe as an alternative connection mechanism to talk to LibreOffice.

-p, --port

:Port to listen on (as listener) or to connect to (as client).

Default port is '2002'.

-s, --server

:Server (address) to listen on (as listener) or to connect to (as client).

Default server is 'localhost'.

--show

List the possible output formats to be used with -f.

--stdout

Print converted output file to stdout.

-t, --template

Specify the template to use for importing styles from. This can be very useful if you have a corporate identity you have to apply to every document you distribute.

-T, --timeout

When unoconv starts its own listener, try to connect to it for an amount of seconds before giving up. Increasing this may help when you receive random errors caused by the listener not being ready to accept conversion jobs.

-v, --verbose

Be more and more and more verbose.

ARGUMENTS

You can provide one or more files as arguments to convert each of them to the specified output format.

IMPORT FILTERS

Depending on the used input file, a different LibreOffice import filter is automatically used by unoconv. This import filter can be influenced by the -i option that, depending on the filter used, accepts different arguments.

It is not always clear what import filter options you can provide, the import dialog in LibreOffice for the filter you ar using might give a good indication as to what you can expect as import filter options.

TEXT IMPORT FILTER OPTIONS

CSV IMPORT FILTER OPTIONS

The CSV import filter accepts a FilterOptions setting, the order is: separator(s),text-delimiter,encoding,first-row,column-format

For example you might want to use this for a real comma-separated document:

-i FilterOptions=44,34,76,2,1/5/2/1/3/1/4/1

which will use a comma (44) as the field separator, a double quote (34) as the text delimiter, UTF-8 (76) for the input encoding, start from the second row and use the specified formats for each column (1 means standard, 5 means YY/MM/DD date)

If you like to use more than one separator (say a space or a tab) and use the system's encoding (9), but with no text-delimiter, you can do:

-i FilterOptions=9/32,,9,2

For a list of possible encoding types, you can use the above link to find the possible options.

• FilterOptions

EXPORT FILTERS

In contrast to import filters, export filters can have multiple named options, although it is not always clear what options are available. It all depends on the version of LibreOffice. The export dialog you get in LibreOffice might give you a clue about what is possible, each of those widgets represents an option.

TEXT EXPORT FILTER OPTIONS

The order of the arguments is: encoding,field-seperator,text-delimiter,quote-all-text-cells,save-cell-content-as-shown

CSV EXPORT FILTER OPTIONS

The CSV export filter accepts various arguments, the order is: field-seperator(s),text-delimiter,encoding

For example you might want to use this for a real comma-separated document:

-e FilterOptions=44,34,76

which will use a comma (44) as the field separator, a double quote (34) as the text delimiter, UTF-8 (76) for the export encoding, start from the second row and use the specified formats for each column (1 means standard, 5 means YY/MM/DD date)

If you like to use more than one separator (say a space or a tab) and use the system's encoding (9), but with no text-delimiter, you can do:

-e FilterOptions=9/32,,9

For a list of possible encoding types, you can use the above link to find the possible options.

• FilterOptions

PDF EXPORT FILTER OPTIONS

The PDF export filter is likely the most advanced export filter in its kind with a myriad of options one can use. The export filter options are described in a separate document, or on LibreOffice's wiki at:

ENVIRONMENT VARIABLES

EXIT STATUS

Normally, the exit status is 0 if the conversion ran successful. If an error has occured, the return code is most likely an error returned by LibreOffice (or its interface, called UNO) however, the error never translates to something meaningful. In case you like to decipher the LibreOffice errCode, look at: