UNOCONV(1)
π UNOCONV(1) β the manual, but make it slay π
okay bestie, sit down, grab a boba, because we are about to convert literally ANY document into literally ANY other document and it's giving main character energy π
β¨ NAME β¨
unoconv β convert any document from and to any LibreOffice supported format. no cap. any. π
πΈ SYNOPSIS πΈ
unoconv [options] file [file2 ..]
unoconv --listener [--server SRV] [--port PRT] [--connection CON]
π¦ DESCRIPTION π¦
so unoconv is a command line utility, and what it does is take any file format that LibreOffice can import and turn it into any file format that LibreOffice can export. that's the whole vibe. that's the assignment. and it ATE. π₯
unoconv uses LibreOffice's UNO bindings to do non-interactive conversion of documents, which means it needs an actual LibreOffice instance to talk to. so if it can't find one, bestie, it just makes its own β a lil temporary one, for the occasion, iconic behaviour honestly. π
and if you want? you can start a "listener" instance instead, so that all your subsequent connections (or even remote connections π) can use it. one listener, many converts, we love efficiency. β¨
π OPTIONS π
-c,--connectionβ the UNO connection string the client uses to connect to a LibreOffice instance, or that the listener uses to make LibreOffice listen.
Default connection string is "socket,host=localhost,port=2002;urp;StarOffice.ComponentContext" β yes queen, that's the one, that's the default.
-d,--doctypeβ tell it what LibreOffice document type the backend format is. possible document types are:document,graphics,presentation,spreadsheet.
Default document type is document. π
-e,--exportβ set specific export filter options (these relate to whichever LibreOffice filter you're using).
eg. for the PDF output filter you can specify: -e PageRange=1-2
See the EXPORT FILTERS section, bestie, there's a whole buffet down there.
-f,--formatβ specify the output format for the document. you can get a list of possible output formats per document type by using the--showoption. π
Default document type is pdf. (yes, the manual literally says "document type" here, we are not fixing it, we are respecting the ancestors π)
-F,--fieldβ replace a user-defined text field with a value.
eg. -F Client_Name="Oracle"
-i,--importβ set specific import filter options (related to the LibreOffice import filter being used, which is picked based on the input filename).
See the IMPORT FILTERS section.
-l,--listenerβ startunoconvas a listener so otherunoconvclients can connect to it. π«Ά-n,--no-launchβ by default, if no listener is running,unoconvwill launch its own (temporary) listener to make sure the conversion works. this option says "no thanks" and just aborts the conversion if no listener is found, instead of starting its own. strong boundaries. we respect it. π-o,--outputβ if the argument is a directory, the converted documents go in that directory. if multiple input files are provided, it's used as a basename (and the output extension gets added). otherwise it's used as the output filename. multitasking icon. β¨--passwordβ provide a password to decrypt the document. π--pipeβ use a pipe as an alternative connection mechanism to talk to LibreOffice.-p,--portβ port to listen on (as a listener) or to connect to (as a client).
Default port is 2002.
--preserveβ keep the timestamp and permissions of the original document. preserving the heritage, we love to see it. π-s,--serverβ server (address) to listen on (as a listener) or to connect to (as a client).
Default server is localhost.
--showβ list the possible output formats to be used with-f. π--stdinβ read the input file from stdin (filenames are ignored if you provide them anyway).--stdoutβ print the converted output file to stdout.-t,--templateβ specify the template to use for importing styles from. this is very useful if you have a corporate identity you have to apply to every single document you distribute. brand consistency is a lifestyle, periodt. π-T,--timeoutβ whenunoconvstarts its own listener, it tries to connect to it for a certain amount of seconds before giving up. increasing this may help when you're getting random errors caused by the listener not being ready to accept conversion jobs. (the listener is just a lil sleepy okay π)-v,--verboseβ be more and more and more verbose. πΈ
π ARGUMENTS π
you can provide one or more files as arguments, and each of them gets converted to the specified output format. give it a whole girl gang of files, it can handle it. π
π§ IMPORT FILTERS π§
depending on the input file you're using, a different LibreOffice import filter is automatically used by unoconv. you can influence that import filter with the -i option, which β depending on the filter in play β accepts different arguments.
ngl, it is not always clear what import filter options you can provide. the import dialog in LibreOffice for the filter you're using might give you a good indication as to what you can expect as import filter options. π
the reference is LibreOffice's documentation. for spreadsheets it's described at: http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Filter_Options but bestie we're gonna look into some examples, don't worry. π«Ά
π DEFAULT IMPORT FILTER OPTIONS π
the default import filter for many imports (eg. Lotus, dBase or DIF) accepts the input encoding-type as its only argument. so if you require utf-8 (76) you can do:
-i FilterOptions=76
for a list of possible encoding types, you can use the above link to find the possible options.
FilterOptions
πΈ TEXT IMPORT FILTER OPTIONS πΈ
the Text import filter accepts a FilterOptions setting holding the input encoding.
FilterOptions
π CSV IMPORT FILTER OPTIONS π
the CSV import filter accepts a FilterOptions setting, and 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). slay. β¨
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's not always clear what options are available. it all depends on the version of LibreOffice you've got. the export dialog you get in LibreOffice might give you a clue about what's possible β each of those widgets represents an option. π
π TEXT EXPORT FILTER OPTIONS π
the Text export filter accepts a FilterOptions setting holding the output encoding.
FilterOptions
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, and 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). (yes, the original says all that even though you only passed three values β we're keeping every word, bestie, that's the rule π)
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:
http://wiki.services.openoffice.org/wiki/API/Tutorials/PDF_export
for example, one can specify: -e PageRange=1-2
here is a list of all the options, however for more details please look in filters.txt:
AllowDuplicateFieldNamesCenterWindowChangesConvertOOoTargetToPDFTargetDisplayPDFDocumentTitleDocumentOpenPasswordEmbedStandardFontsEnableCopyingOfContentEnableTextAccessForAccessibilityToolsEncryptFileExportBookmarksExportBookmarksToPDFDestinationExportFormFieldsExportLinksRelativeFsysExportNotesExportNotesPagesFirstPageOnLeftFormsTypeHideViewerMenubarHideViewerToolbarHideViewerWindowControlsInitialPageInitialViewIsAddStreamIsSkipEmptyPagesMagnificationMaxImageResolutionOpenBookmarkLevelsOpenInFullScreenModePageLayoutPageRangePDFViewSelectionPermissionPasswordPrintingQualityReduceImageResolutionResizeWindowToInitialPageRestrictPermissionPasswordSelectionSelectPdfVersionUseLosslessCompressionUseTaggedPDFUseTransitionEffectsWatermarkZoom
π¨ GRAPHICS EXPORT FILTER OPTIONS π¨
HeightResolutionWidth
πΌοΈ BMP EXPORT FILTER OPTIONS πΌοΈ
CompressionRLEEncoding
πΈ JPEG EXPORT FILTER OPTIONS πΈ
ColorDepthQuality
π«οΈ PBM/PGM/PPM EXPORT FILTER OPTIONS π«οΈ
Encoding
π¦ PNG EXPORT FILTER OPTIONS π¦
CompressionInterlacedMode
π GIF EXPORT FILTER OPTIONS π
InterlacedModeTransparency
β¨ EPS EXPORT FILTER OPTIONS β¨
ColorFormatCompressionPreviewVersion
β EXAMPLES β
you can use unoconv in standalone mode, which means that in the absence of a LibreOffice listener, it starts its own:
unoconv -f pdf some-document.odt
one can use unoconv as a listener (by default localhost:2002) to let other unoconv instances connect to it:
unoconv --listener &
unoconv -f pdf some-document.odt
unoconv -f doc other-document.odt
unoconv -f jpg some-image.png
unoconv -f xsl some-spreadsheet.csv
kill -15 %-
this also works on a remote host:
unoconv --listener --server 1.2.3.4 --port 4567
and then connect another system to convert documents:
unoconv --server 1.2.3.4 --port 4567
π± ENVIRONMENT VARIABLES π±
UNO_PATHβ specifies what LibreOffice pyuno installationunoconvneeds to use. eg./opt/libreoffice3.4/basis-link/program
π EXIT STATUS π
okay bestie, so normally the exit status is 0 if the conversion ran successful. slay. that's the good path. β¨
but 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. it's giving cryptic. it's giving β¨mysteryβ¨. it is NOT giving helpful.
so if you're the kind of main character who likes to decipher the LibreOffice errCode, go look at:
http://cgit.freedesktop.org/libreoffice/core/tree/tools/inc/tools/errcode.hxx
http://cgit.freedesktop.org/libreoffice/core/tree/svtools/inc/svtools/sfxecode.hxx
http://cgit.freedesktop.org/libreoffice/core/tree/svtools/inc/svtools/soerr.hxx
using the above lists, the error code 2074 means:
Class: 1 (ERRCODE_CLASS_ABORT)
Code: 26 (ERRCODE_IO_INVALIDPARAMETER or SVSTREAM_INVALID_PARAMETER)
and the error code 3088 means:
Class: 3 (ERRCODE_CLASS_NOTEXISTS)
Code: 16 (ERRCODE_IO_CANTWRITE)
so yeah. numbers mean things. iykyk. π’
π SEE ALSO π
convert(1), file(1), odt2txt
π BUGS π
unoconv uses the UNO bindings to connect to LibreOffice β and in absence of a usable socket, it will start its own LibreOffice instance with the correct parameters. so it just. does that. unprompted. iconic behavior honestly. π
Note Please see the TODO file for known bugs and future plans. π«Ά
π REFERENCES π
unoconv is very useful together with the following tools:
Asciidoc
http://www.methods.co.nz/asciidoc/
asciidoc-odf
http://github.com/dagwieers/asciidoc-odf
docbook2odf
http://open.comsultia.com/docbook2odf/
A list of possible import and export formats is available from:
OpenOffice 2.1
http://wiki.services.openoffice.org/wiki/Framework/Article/Filter/FilterList_OOo_2_1
OpenOffice 3.0
http://wiki.services.openoffice.org/wiki/Framework/Article/Filter/FilterList_OOo_3_0
π AUTHOR π
Written by Dag Wieers, <dag@wieers.com>[1]
π RESOURCES π
Main web site: http://dag.wieers.com/home-made/unoconv/
π COPYING π
Copyright (C) 2007 Dag Wieers. Free use of this software is granted under the terms of the GNU General Public License (GPL). periodt. π
β¨ AUTHOR β¨
Dag Wieers <dag@wieers.com>
- Author.
π NOTES π
dag@wieers.commailto:dag@wieers.com
and that's a wrap bestie!! π this whole page is from unoconv version 0.4, dated 20 october 2010, and it's UNOCONV(1) β go forth and convert things, you absolute icon πβ¨π
π¦ where this page comes from
- debian bookworm: unoconv 0.7-2
- ubuntu jammy: unoconv 0.7-2ubuntu1
- ubuntu noble: unoconv 0.7-2ubuntu1
- ubuntu questing: unoconv 0.7-2ubuntu1
- ubuntu resolute: unoconv 0.7-2ubuntu2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms