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