emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jambunathan K <kjambunathan@gmail.com>
To: Andreas Leha <andreas.leha@med.uni-goettingen.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: [RFC][ODT] Converting to pdf (or other formats) via odt
Date: Thu, 09 Feb 2012 01:50:44 +0530	[thread overview]
Message-ID: <81aa4t2i1v.fsf@gmail.com> (raw)
In-Reply-To: <87haz266yr.fsf@med.uni-goettingen.de> (Andreas Leha's message of "Tue, 07 Feb 2012 15:42:04 +0100")

Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:

> Jambunathan K <kjambunathan@gmail.com> 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 <kjambunathan@gmail.com> 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/ ~/tmp-odt/convert.odt
| convert ~\tmp-odt\convert.odt -> ~\tmp-odt\convert.docx using Office Open XML Text
`----

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

Footnotes: 

[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
   http://listarchives.libreoffice.org/global/users/msg15104.html

2. From git repo
   http://cgit.freedesktop.org/libreoffice/filters/tree/filter/source/config/fragments/filters/
-- 

  reply	other threads:[~2012-02-08 20:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-02 20:59 [RFC][ODT] Converting to pdf (or other formats) via odt Jambunathan K
2012-02-02 21:05 ` Jambunathan K
2012-02-07 14:42   ` Andreas Leha
2012-02-08 20:20     ` Jambunathan K [this message]
2012-02-14 22:25       ` Andreas Leha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=81aa4t2i1v.fsf@gmail.com \
    --to=kjambunathan@gmail.com \
    --cc=andreas.leha@med.uni-goettingen.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).