[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [RFC][ODT] Converting to pdf (or other formats) via odt

From: Jambunathan K
Subject: Re: [O] [RFC][ODT] Converting to pdf (or other formats) via odt
Date: Thu, 09 Feb 2012 01:50:44 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (windows-nt)

Andreas Leha <address@hidden> writes:

> Jambunathan K <address@hidden> writes:
>> I committed the changes only a few minutes ago as part of Org-mode
>> version 7.8.03 (release_7.8.03.300.g9b820)
>> So the Org version should be at or above the 300th version.
>> Jambunathan K <address@hidden> writes:
>>> Thanks to Giles[1] for introducing us to the "--convert-to" option of
>>> soffice.exe.  The option seems to be a fairly recent development[2].
>>> With this change, one can export to pdf (or any other popular format)
>>> via odt by a simple
>>> #+begin_src emacs-lisp
>>>   (setq org-export-odt-preferred-output-format "pdf")
>>> #+end_src
>>> There is no need to install additional converters. It is assumed that
>>> the user has a working and fairly recent LibreOffice installation.
>>> Footnotes: 
>>> [1]
>>> http://imperfectsoftware.blogspot.in/2012/01/one-of-my-less-enjoyable-tasks-is-to.html
>>> [2] There seems to be a bunch of fairly recent bugs with this option. So
>>> a cutting edge LibreOffice would definitely be needed.
>>> http://www.google.co.in/search?q=headless+%22--convert-to%22+site%3Alibreoffice.org&btnG=Search&sclient=psy-ab&hl=en&site=&source=hp&gbv=1&sei=L_gqT97rIMXorAf248C6DA
>>> Feedback welcome.
> Hi Jambunathan,
> this sounds great.  Unfortunately, this does not seem to work for me.
> Just pulled (last commit c4b233453ca846351bb5ba0893ebb2b8a5b3a941 Merge
> branch 'maint') and I do get
>  "org-lparse: Don't know how to export to backend docx via odt"
> What did I miss?

The ODT exporter takes the list of known formats based on settings of
`org-export-odt-convert-capabilities'. The above error indicates that
docx is not part of the capabilities list. You can add an extension of
your choosing by:

M-x customize-variable RET org-export-odt-convert-capabilities RET

I have now revised the setting of the above variable[1] to include
"docx" . 

Export to docx should work fine now [2]. You will see the following in
the messages buffer:

| Executing soffice --headless --convert-to docx --outdir ~/tmp-odt/ 
| convert ~\tmp-odt\convert.odt -> ~\tmp-odt\convert.docx using Office Open XML 

There are multiple output filters associated with a "docx" extension -
"Office Open XML Text" seen above is one such filter . "Microsoft Word
2007/2010 XML" is the other one. (One can see these options in "Save As"
UI of LibreOffice) [3].


[1] (info "(org) Exporting and converting to other formats")
[2] Conversion works with LibreOffice 3.4.5. 

To open the resulting "docx" file with LibreOffice and not with docview,
you may want to customize `org-file-apps' suitably.

[3] Similarly there are multiple output filters for the "doc" extension.

Currently the ODT exporter's converter interface doesn't support
choosing a particular output filter for a given document extension and
lets LibreOffice choose a "suitable" one. (ie it doesn't support
output_filter_name option down below)

,---- soffice command line syntax:
| /opt/libreoffice3.4/program/soffice --help
| LibreOffice 3.4 340m1(Build:101)
| Usage: soffice [options] [documents...]
| Options:
| --minimized keep startup bitmap minimized.
| --invisible no startup screen, no default document and no UI.
| --norestore suppress restart/restore after fatal errors.
| --quickstart starts the quickstart service
| --nologo don't show startup screen.
| --nolockcheck don't check for remote instances using the installation
| --nodefault don't start with an empty document
| --headless like invisible but no userinteraction at all.
| --help/-h/-? show this message and exit.
| --version display the version information.
| --writer create new text document.
| --calc create new spreadsheet document.
| --draw create new drawing.
| --impress create new presentation.
| --base create new database.
| --math create new formula.
| --global create new global document.
| --web create new HTML document.
| -o open documents regardless whether they are templates or not.
| -n always open documents as new files (use as template).
| --display <display>
| Specify X-Display to use in Unix/X11 versions.
| -p <documents...>
| print the specified documents on the default printer.
| --pt <printer> <documents...>
| print the specified documents on the specified printer.
| --view <documents...>
| open the specified documents in viewer-(readonly-)mode.
| --show <presentation>
| open the specified presentation and start it immediately
| --accept=<accept-string>
| Specify an UNO connect-string to create an UNO acceptor through which
| other programs can connect to access the API
| --unaccept=<accept-string>
| Close an acceptor that was created with -accept=<accept-string>
| Use -unnaccept=all to close all open acceptors
| --infilter=<filter>
| Force an input filter type if possible
| Eg. -infilter="Calc Office Open XML"
| --convert-to output_file_extension[:output_filter_name] [-outdir
| ouput_dir] files
| Batch convert files.
| If -outdir is not specified then current working dir is used as
| output_dir.
| Eg. -convert-to pdf *.doc
| -convert-to pdf:writer_pdf_Export -outdir /home/user *.doc
| --print-to-file [-printer-name printer_name] [-outdir ouput_dir] files
| Batch print files to file.
| If -outdir is not specified then current working dir is used as
| output_dir.
| Eg. -print-to-file *.doc
| -print-to-file -printer-name nasty_lowres_printer -outdir
| /home/user *.doc

Filters in LibreOffice:
1. Using Basic Macro

2. From git repo

reply via email to

[Prev in Thread] Current Thread [Next in Thread]