1UNOCONV(1) UNOCONV(1)
2
3
4
6 unoconv - convert any document from and to any LibreOffice supported
7 format
8
10 unoconv [options] file [file2 ..]
11
12 unoconv --listener [--server SRV] [--port PRT] [--connection CON]
13
15 unoconv is a command line utility that can convert any file format that
16 LibreOffice can import, to any file format that LibreOffice is capable
17 of exporting.
18
19 unoconv uses the LibreOffice’s UNO bindings for non-interactive
20 conversion of documents and therefore needs an LibreOffice instance to
21 communicate with. Therefore if it cannot find one, it will start its
22 own instance for temporary usage. If desired, one can start a
23 “listener” instance to use for subsequent connections or even for
24 remote connections.
25
27 -c, --connection
28 UNO connection string to be used by the client to connect to an
29 LibreOffice instance, or used by the listener to make LibreOffice
30 listen.
31
32 Default connection string is "socket,host=localhost,port=2002;urp;StarOffice.ComponentContext"
33
34 -d, --doctype
35 Specify the LibreOffice document type of the backend format.
36 Possible document types are: document, graphics, presentation,
37 spreadsheet.
38
39 Default document type is 'document'.
40
41 -e, --export
42 Set specific export filter options (related to the used LibreOffice
43 filter).
44
45 eg. for the PDF output filter one can specify: -e PageRange=1-2
46
47 See the *EXPORT FILTERS* section.
48
49 -f, --format
50 Specify the output format for the document. You can get a list of
51 possible output formats per document type by using the --show
52 option.
53
54 Default document type is 'pdf'.
55
56 -F, --field
57 Add or replace user-defined text field with value
58
59 eg. -F Client_Name="Oracle"
60
61 -i, --import
62 Set specific import filters options (related to the used
63 LibreOffice import filter based on the input filename).
64
65 See the *IMPORT FILTERS* section.
66
67 -I, --input-filter-name
68 Specify the input filter name, used when the file ending doesn’t
69 match the file type.
70
71 eg -I odt
72
73 -l, --listener
74 Start unoconv as listener for unoconv clients to connect to.
75
76 -M, --meta
77 Add or replace document metadata with value
78
79 eg. -M Author="Dag Wieers"
80
81 -n, --no-launch
82 By default if no listener is running, unoconv will launch its own
83 (temporary) listener to make sure the conversion works. This option
84 will abort the conversion if no listener is found, rather than
85 starting our own listener.
86
87 -o, --output
88 If the argument is a directory, put the converted documents in this
89 directory. If multiple input files are provided, use it as a
90 basename (and add output extension). Otherwise use it as the output
91 filename.
92
93 --password
94 Provide a password to decrypt the document
95
96 --pipe
97 Use a pipe as an alternative connection mechanism to talk to
98 LibreOffice.
99
100 -p, --port
101 Port to listen on (as listener) or to connect to (as client).
102
103 Default port is '2002'.
104
105 --preserve
106 Keep timestamp and permissions of the original document
107
108 -s, --server
109 Server (address) to listen on (as listener) or to connect to (as
110 client).
111
112 Default server is 'localhost'.
113
114 --show
115 List the possible output formats to be used with -f.
116
117 --stdin
118 Read input file from stdin (filenames are ignored if provided)
119
120 --stdout
121 Print converted output file to stdout.
122
123 -t, --template
124 Specify the template to use for importing styles from. This can be
125 very useful if you have a corporate identity you have to apply to
126 every document you distribute.
127
128 -T, --timeout
129 When unoconv starts its own listener, try to connect to it for an
130 amount of seconds before giving up. Increasing this may help when
131 you receive random errors caused by the listener not being ready to
132 accept conversion jobs.
133
134 -v, --verbose
135 Be more and more and more verbose.
136
138 You can provide one or more files as arguments to convert each of them
139 to the specified output format.
140
142 Depending on the used input file, a different LibreOffice import filter
143 is automatically used by unoconv. This import filter can be influenced
144 by the -i option that, depending on the filter used, accepts different
145 arguments.
146
147 It is not always clear what import filter options you can provide, the
148 import dialog in LibreOffice for the filter you ar using might give a
149 good indication as to what you can expect as import filter options.
150
151 The reference is LibreOffice’s documentation, for spreadsheets it is
152 described at:
153 http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Filter_Options
154 but we will look into some examples.
155
157 The default import filter for many imports (eg. Lotus, dBase or DIF)
158 accepts as the only argument the input encoding-type, so if you require
159 utf-8 (76) you can do:
160
161 -i FilterOptions=76
162
163 For a list of possible encoding types, you can use the above link to
164 find the possible options.
165
166 · FilterOptions
167
169 The Text import filter accepts a FilterOptions setting holding the
170 input encoding.
171
172 · FilterOptions
173
175 The CSV import filter accepts a FilterOptions setting, the order is:
176 separator(s),text-delimiter,encoding,first-row,column-format
177
178 For example you might want to use this for a real comma-separated
179 document:
180
181 -i FilterOptions=44,34,76,2,1/5/2/1/3/1/4/1
182
183 which will use a comma (44) as the field separator, a double quote (34)
184 as the text delimiter, UTF-8 (76) for the input encoding, start from
185 the second row and use the specified formats for each column (1 means
186 standard, 5 means YY/MM/DD date)
187
188 If you like to use more than one separator (say a space or a tab) and
189 use the system’s encoding (9), but with no text-delimiter, you can do:
190
191 -i FilterOptions=9/32,,9,2
192
193 For a list of possible encoding types, you can use the above link to
194 find the possible options.
195
196 · FilterOptions
197
199 In contrast to import filters, export filters can have multiple named
200 options, although it is not always clear what options are available. It
201 all depends on the version of LibreOffice. The export dialog you get in
202 LibreOffice might give you a clue about what is possible, each of those
203 widgets represents an option.
204
206 The Text export filter accepts a FilterOptions setting holding the
207 output encoding.
208
209 · FilterOptions
210
211 The order of the arguments is:
212 encoding,field-seperator,text-delimiter,quote-all-text-cells,save-cell-content-as-shown
213
215 The CSV export filter accepts various arguments, the order is:
216 field-seperator(s),text-delimiter,encoding
217
218 For example you might want to use this for a real comma-separated
219 document:
220
221 -e FilterOptions=44,34,76
222
223 which will use a comma (44) as the field separator, a double quote (34)
224 as the text delimiter, UTF-8 (76) for the export encoding, start from
225 the second row and use the specified formats for each column (1 means
226 standard, 5 means YY/MM/DD date)
227
228 If you like to use more than one separator (say a space or a tab) and
229 use the system’s encoding (9), but with no text-delimiter, you can do:
230
231 -e FilterOptions=9/32,,9
232
233 For a list of possible encoding types, you can use the above link to
234 find the possible options.
235
236 · FilterOptions
237
239 The PDF export filter is likely the most advanced export filter in its
240 kind with a myriad of options one can use. The export filter options
241 are described in a separate document, or on LibreOffice’s wiki at:
242
243 http://wiki.services.openoffice.org/wiki/API/Tutorials/PDF_export
244
245 For example one can specify: -e PageRange=1-2
246
247 Here is a list of all options, however for more details please look in
248 filters.txt:
249
250 · AllowDuplicateFieldNames
251
252 · CenterWindow
253
254 · Changes
255
256 · ConvertOOoTargetToPDFTarget
257
258 · DisplayPDFDocumentTitle
259
260 · DocumentOpenPassword
261
262 · EmbedStandardFonts
263
264 · EnableCopyingOfContent
265
266 · EnableTextAccessForAccessibilityTools
267
268 · EncryptFile
269
270 · ExportBookmarks
271
272 · ExportBookmarksToPDFDestination
273
274 · ExportFormFields
275
276 · ExportLinksRelativeFsys
277
278 · ExportNotes
279
280 · ExportNotesPages
281
282 · FirstPageOnLeft
283
284 · FormsType
285
286 · HideViewerMenubar
287
288 · HideViewerToolbar
289
290 · HideViewerWindowControls
291
292 · InitialPage
293
294 · InitialView
295
296 · IsAddStream
297
298 · IsSkipEmptyPages
299
300 · Magnification
301
302 · MaxImageResolution
303
304 · OpenBookmarkLevels
305
306 · OpenInFullScreenMode
307
308 · PageLayout
309
310 · PageRange
311
312 · PDFViewSelection
313
314 · PermissionPassword
315
316 · Printing
317
318 · Quality
319
320 · ReduceImageResolution
321
322 · ResizeWindowToInitialPage
323
324 · RestrictPermissionPassword
325
326 · Selection
327
328 · SelectPdfVersion
329
330 · UseLosslessCompression
331
332 · UseTaggedPDF
333
334 · UseTransitionEffects
335
336 · Watermark
337
338 · Zoom
339
340 GRAPHICS EXPORT FILTER OPTIONS
341 · Height
342
343 · Resolution
344
345 · Width
346
347 BMP EXPORT FILTER OPTIONS
348 · Compression
349
350 · RLEEncoding
351
352 JPEG EXPORT FILTER OPTIONS
353 · ColorDepth
354
355 · Quality
356
357 PBM/PGM/PPM EXPORT FILTER OPTIONS
358 · Encoding
359
360 PNG EXPORT FILTER OPTIONS
361 · Compression
362
363 · InterlacedMode
364
365 GIF EXPORT FILTER OPTIONS
366 · InterlacedMode
367
368 · Transparency
369
370 EPS EXPORT FILTER OPTIONS
371 · ColorFormat
372
373 · Compression
374
375 · Preview
376
377 · Version
378
380 You can use unoconv in standalone mode, this means that in absence of
381 an LibreOffice listener, it will starts its own:
382
383 unoconv -f pdf some-document.odt
384
385 One can use unoconv as a listener (by default localhost:2002) to let
386 other unoconv instances connect to it:
387
388 unoconv --listener &
389 unoconv -f pdf some-document.odt
390 unoconv -f doc other-document.odt
391 unoconv -f jpg some-image.png
392 unoconv -f xsl some-spreadsheet.csv
393 kill -15 %-
394
395 This also works on a remote host:
396
397 unoconv --listener --server 1.2.3.4 --port 4567
398
399 and then connect another system to convert documents:
400
401 unoconv --server 1.2.3.4 --port 4567
402
404 UNO_PATH
405 specifies what LibreOffice pyuno installation unoconv needs to use
406 eg. /opt/libreoffice3.4/basis-link/program
407
409 Normally, the exit status is 0 if the conversion ran successful. If an
410 error has occured, the return code is most likely an error returned by
411 LibreOffice (or its interface, called UNO) however, the error never
412 translates to something meaningful. In case you like to decipher the
413 LibreOffice errCode, look at:
414
415 http://cgit.freedesktop.org/libreoffice/core/tree/tools/inc/tools/errcode.hxx
416 http://cgit.freedesktop.org/libreoffice/core/tree/svtools/inc/svtools/sfxecode.hxx
417 http://cgit.freedesktop.org/libreoffice/core/tree/svtools/inc/svtools/soerr.hxx
418
419 Using the above lists, the error code 2074 means:
420
421 Class: 1 (ERRCODE_CLASS_ABORT)
422 Code: 26 (ERRCODE_IO_INVALIDPARAMETER or SVSTREAM_INVALID_PARAMETER)
423
424 And the error code 3088 means:
425
426 Class: 3 (ERRCODE_CLASS_NOTEXISTS)
427 Code: 16 (ERRCODE_IO_CANTWRITE)
428
430 convert(1), file(1), odt2txt
431
433 unoconv uses the UNO bindings to connect to LibreOffice, in absence of
434 a usable socket, it will start its own LibreOffice instance with the
435 correct parameters.
436
437 Note
438 Please see the TODO file for known bugs and future plans.
439
441 unoconv is very useful together with the following tools:
442
443 Asciidoc
444 http://www.methods.co.nz/asciidoc/
445
446 asciidoc-odf
447 http://github.com/dagwieers/asciidoc-odf
448
449 docbook2odf
450 http://open.comsultia.com/docbook2odf/
451
452 A list of possible import and export formats is available from:
453
454 OpenOffice 2.1
455 http://wiki.services.openoffice.org/wiki/Framework/Article/Filter/FilterList_OOo_2_1
456
457 OpenOffice 3.0
458 http://wiki.services.openoffice.org/wiki/Framework/Article/Filter/FilterList_OOo_3_0
459
461 Written by Dag Wieers, <dag@wieers.com[1]>
462
464 Main web site: http://dag.wieers.com/home-made/unoconv/
465
467 Copyright (C) 2007 Dag Wieers. Free use of this software is granted
468 under the terms of the GNU General Public License (GPL).
469
471 Dag Wieers <dag@wieers.com>
472 Author.
473
475 1. dag@wieers.com
476 mailto:dag@wieers.com
477
478
479
480 0.4 20 october 2010 UNOCONV(1)