From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Leha Subject: Re: [RFC][ODT] Converting to pdf (or other formats) via odt Date: Tue, 14 Feb 2012 23:25:51 +0100 Message-ID: <87zkcl128g.fsf@med.uni-goettingen.de> References: <81sjitx86z.fsf@gmail.com> <81obthx7xn.fsf@gmail.com> <87haz266yr.fsf@med.uni-goettingen.de> <81aa4t2i1v.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:58168) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RxQpL-0004S2-41 for emacs-orgmode@gnu.org; Tue, 14 Feb 2012 17:26:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RxQpJ-0005OK-8G for emacs-orgmode@gnu.org; Tue, 14 Feb 2012 17:26:23 -0500 Received: from plane.gmane.org ([80.91.229.3]:47188) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RxQpI-0005O9-Sy for emacs-orgmode@gnu.org; Tue, 14 Feb 2012 17:26:21 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1RxQpF-0003Mz-OT for emacs-orgmode@gnu.org; Tue, 14 Feb 2012 23:26:17 +0100 Received: from vpn-2205.gwdg.de ([134.76.2.205]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 14 Feb 2012 23:26:17 +0100 Received: from andreas.leha by vpn-2205.gwdg.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 14 Feb 2012 23:26:17 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Jambunathan K writes: > Andreas Leha writes: > >> Jambunathan K 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 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 > | Specify X-Display to use in Unix/X11 versions. > | -p > | print the specified documents on the default printer. > | --pt > | print the specified documents on the specified printer. > | --view > | open the specified documents in viewer-(readonly-)mode. > | --show > | open the specified presentation and start it immediately > | --accept= > | Specify an UNO connect-string to create an UNO acceptor through which > | other programs can connect to access the API > | --unaccept= > | Close an acceptor that was created with -accept= > | Use -unnaccept=all to close all open acceptors > | --infilter= > | 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/ Hi Jambunathan, thanks, this works great now. Saves another few mouse clicks. Just for the record: For me it regularly fails, if I have LibreOffice started (and pointing to the .odt/.doc, not sure if this is important). Regards, Andreas