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