File: unoconv.1.adoc

package info (click to toggle)
unoconv 0.7-2.1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 580 kB
  • sloc: python: 979; makefile: 147; sh: 10
file content (418 lines) | stat: -rw-r--r-- 11,796 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
= unoconv(1)
Dag Wieers <dag@wieers.com>
v0.4, 20 october 2010


== 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.
+
    Default connection string is "socket,host=localhost,port=2002;urp;StarOffice.ComponentContext"

-d, --doctype::
    Specify the LibreOffice document type of the backend format. Possible
    document types are: 'document', 'graphics', 'presentation',
    'spreadsheet'.
+
    Default document type is 'document'.

-e, --export::
    Set specific export filter options (related to the used LibreOffice filter).
+
    eg. for the PDF output filter one can specify: -e PageRange=1-2
+
    See the *EXPORT FILTERS* section.

-f, --format::
    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'.

-F, --field::
    Replace user-defined text field with value
+
    eg. -F Client_Name="Oracle"

-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.

--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 listener) or to connect to (as client).
+
    Default port is '2002'.

--preserve::
    Keep timestamp and permissions of the original document

-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+.

--stdin::
    Read input file from stdin (filenames are ignored if provided)

--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.

The reference is LibreOffice's documentation, for spreadsheets it is described at:
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Filter_Options
but we will look into some examples.


== DEFAULT IMPORT FILTER OPTIONS
The default import filter for many imports (eg. Lotus, dBase or DIF) accepts
as the only argument the input encoding-type, 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, 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 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, 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:

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 options, however for more details please look in
'filters.txt':

 - AllowDuplicateFieldNames
 - CenterWindow
 - Changes
 - ConvertOOoTargetToPDFTarget
 - DisplayPDFDocumentTitle
 - DocumentOpenPassword
 - EmbedStandardFonts
 - EnableCopyingOfContent
 - EnableTextAccessForAccessibilityTools
 - EncryptFile
 - ExportBookmarks
 - ExportBookmarksToPDFDestination
 - ExportFormFields
 - ExportLinksRelativeFsys
 - ExportNotes
 - ExportNotesPages
 - FirstPageOnLeft
 - FormsType
 - HideViewerMenubar
 - HideViewerToolbar
 - HideViewerWindowControls
 - InitialPage
 - InitialView
 - IsAddStream
 - IsSkipEmptyPages
 - Magnification
 - MaxImageResolution
 - OpenBookmarkLevels
 - OpenInFullScreenMode
 - PageLayout
 - PageRange
 - PDFViewSelection
 - PermissionPassword
 - Printing
 - Quality
 - ReduceImageResolution
 - ResizeWindowToInitialPage
 - RestrictPermissionPassword
 - Selection
 - SelectPdfVersion
 - UseLosslessCompression
 - UseTaggedPDF
 - UseTransitionEffects
 - Watermark
 - Zoom

=== GRAPHICS EXPORT FILTER OPTIONS
 - Height
 - Resolution
 - Width

==== BMP EXPORT FILTER OPTIONS
 - Compression
 - RLEEncoding

==== JPEG EXPORT FILTER OPTIONS
 - ColorDepth
 - Quality

==== PBM/PGM/PPM EXPORT FILTER OPTIONS
 - Encoding

==== PNG EXPORT FILTER OPTIONS
 - Compression
 - InterlacedMode

==== GIF EXPORT FILTER OPTIONS
 - InterlacedMode
 - Transparency

==== EPS EXPORT FILTER OPTIONS
 - ColorFormat
 - Compression
 - Preview
 - Version

== EXAMPLES
You can use unoconv in standalone mode, this means that in absence of an
LibreOffice listener, it will 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 installation unoconv needs to use
    eg. _/opt/libreoffice3.4/basis-link/program_


== 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:

    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)


== SEE ALSO
    convert(1), file(1), odt2txt


== BUGS
unoconv uses the UNO bindings to connect to LibreOffice, in absence of a usable
socket, it will start its own LibreOffice instance with the correct parameters.

[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, <mailto:dag@wieers.com[]>


== 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).

// vim: set syntax=asciidoc