Looking for a code portion: import/export document formats

classic Classic list List threaded Threaded
7 messages Options
docminer docminer
Reply | Threaded
Open this post in threaded view
|

Looking for a code portion: import/export document formats

Hi,

I want to re-use in other project the LibreOffice's document transformation features. For example, read a MS Word document and save it as Adobe PDF file.

I've downloaded the source codes and looked at them, but LO is a very large project. Where I can found those sources?

Thanks,
Pablo.
Michael Stahl-2 Michael Stahl-2
Reply | Threaded
Open this post in threaded view
|

Re: Looking for a code portion: import/export document formats

On 13/08/12 11:26, docminer wrote:
> Hi,
>
> I want to re-use in other project the LibreOffice's document transformation
> features. For example, read a MS Word document and save it as Adobe PDF
> file.
>
> I've downloaded the source codes and looked at them, but LO is a very large
> project. Where I can found those sources?

the document conversion engines in LibreOffice are called Writer, Calc,
Draw and Impress.  conversion from e.g. DOCX to ODT happens by importing
the DOCX file with the DOCX import filter into Writer, and then
exporting the document from Writer with the ODF export filter.

the best option of using LibreOffice for your purpose is to install it
and connect to it via UNO; read the OOo Dev Guide for details:

http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/FirstSteps/First_Contact

there is a simple example program that prints documents from Python:

http://cgit.freedesktop.org/libreoffice/core/tree/bin/convwatch.py

_______________________________________________
LibreOffice mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/libreoffice
Michael Meeks-2 Michael Meeks-2
Reply | Threaded
Open this post in threaded view
|

Re: Looking for a code portion: import/export document formats


On Mon, 2012-08-13 at 11:52 +0200, Michael Stahl wrote:
> the best option of using LibreOffice for your purpose is to install it
> and connect to it via UNO; read the OOo Dev Guide for details:

        Or to run it from the command-line with:

        --headless --convert-to pdf foo.doc

        The UNO / remote automation stuff has always seemed a horrible way of
doing the simpler conversion cases, and now we have the commandline
sorted out - I'd love to encourage people to spawn that directly.

        ATB,

                Michael.

--
[hidden email]  <><, Pseudo Engineer, itinerant idiot

_______________________________________________
LibreOffice mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/libreoffice
docminer docminer
Reply | Threaded
Open this post in threaded view
|

Re: Looking for a code portion: import/export document formats

In reply to this post by Michael Stahl-2
Hi,

Thank you for the info. But what I trying to achieve is displaying documents on mobile devices and desktops regardless the format and the platform. So, I guess I need to run some LO source code on those platforms.

At the present, DocMiner (www.docminer.com) is able to display any document ODF, MS Office, Adobe PDF,... on mobile devices by using a LO instance on a remote server in order to transform them.

Example:

MS Office -> LibreOffice -> PDF -> SWFTools -> SWF -> Adobe AIR -> iOS & Android.

Well, at the present DocMiner uses jodConverter which looks similar to UNO transformation service (in essence). I want to replace the transformation remote service by a local service. The only way is by running LibreOffice (entirely or partially) on mobile platforms.

So, I've two alternatives:
1. Run the entire LibreOffice suite on Android, iOS ,... and use UNO (performance problems?)
2. Use some relevant LO  source code parts only to transform document formats.

What do you recommend?

Tip: in order to run LibreOffice on Android, iOS, Windows, MacOS X, and Linux ( this last requires Flash on Google Chrome browser) I will use Adobe's Alchemy 2 which can compile C/C++ source code in AVM bytecodes -> C/C++ runs on Flash Player/AIR.

Thanks,
Pablo.






docminer docminer
Reply | Threaded
Open this post in threaded view
|

Re: Looking for a code portion: import/export document formats

In reply to this post by Michael Meeks-2
So it's clear: I only need someone running LO on Android and iOS and then invoke the command line in order to transform document formats. I'll look for those distributions (if they exists...?)

Alternatively, I've an Adobe's Alchemy 2 compiler, and I'll try to compile LO too by using it. Although I would prefer to use a native LO distribution for mobile OS.

Thanks,
Pablo.

Michael Meeks-2 Michael Meeks-2
Reply | Threaded
Open this post in threaded view
|

Re: Looking for a code portion: import/export document formats


On Mon, 2012-08-13 at 03:57 -0700, docminer wrote:
> So it's clear: I only need someone running LO on Android and iOS and then
> invoke the command line in order to transform document formats. I'll look
> for those distributions (if they exists...?)

        Ah - well, I'd play with our Android cross-compile vs. master - you can
generate a nice native app there that will convert anything to anything
for you :-) so building a PDF from it is fine.

        We're building a native viewer component from that as well, that is
going rather well; checkout android/experimental/LibreOffice4Android
there. You'll need the SDK and NDK installed.

        ATB,

                Michael.

--
[hidden email]  <><, Pseudo Engineer, itinerant idiot

_______________________________________________
LibreOffice mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/libreoffice
Bjoern Michaelsen Bjoern Michaelsen
Reply | Threaded
Open this post in threaded view
|

Re: Looking for a code portion: import/export document formats

In reply to this post by Michael Meeks-2
Hi,

On Mon, Aug 13, 2012 at 11:37:24AM +0100, Michael Meeks wrote:

>
> On Mon, 2012-08-13 at 11:52 +0200, Michael Stahl wrote:
> > the best option of using LibreOffice for your purpose is to install it
> > and connect to it via UNO; read the OOo Dev Guide for details:
>
> Or to run it from the command-line with:
>
> --headless --convert-to pdf foo.doc
>
> The UNO / remote automation stuff has always seemed a horrible way of
> doing the simpler conversion cases, and now we have the commandline
> sorted out - I'd love to encourage people to spawn that directly.

Note however that for batch conversion, there are limits due to commandline
length and starting an new instance again and again wouldnt improve performance
either. Your best bet for large batch conversions is using the unoconv wrapper
and which can reuse one instance of LibreOffice and remotely trigger the
conversion via UNO(*) without having to restart an instance again and again.

http://askubuntu.com/questions/171243/error-converting-thousands-of-documents-with-libreoffice/171249#171249

Best,

Bjoern

(*) Despite Michaels anti-UNO rants, which you should ignore in this case. I
suspect Michael has an "I hate UNO" sticker on his bumper and is the president
of the UNO hater club.
_______________________________________________
LibreOffice mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/libreoffice