FW: Re: Exporting documents as PDF in Android Viewer

Mert Tümer merttumer at outlook.com
Thu Dec 8 10:15:11 UTC 2016



Sent from my Sony Xperia™ smartphone

---- Original Message ----
Subject: Re: Exporting documents as PDF in Android Viewer
Sent: Dec 8, 2016 12:01
From: Michael Meeks <michael.meeks at collabora.com>
To: Mert Tümer <merttumer at outlook.com>
Cc:

Hi Mert,

        Can I CC: the libreoffice at lists.freedesktop.org list here on this one ?
it's prolly best to get wider and quicker input, perhaps you can fwd
this one there as you reply ? =)

On 08/12/16 08:22, Mert Tümer wrote:
> I'm trying to add "export as pdf feature" to the Android Viewer. Based
> on your comment
> in https://bugs.documentfoundation.org/show_bug.cgi?id=89860#c4,
> however, i couldn't do that. I couldn't find any pdf conversions bits in
> lokandroid.cxx file. There is just one function that i think it can do
> the job which is

        Ah - right =) so that file lokandroid.cxx is a (somewhat out of date)
Java wrapper of the LibreOfficeKit API which you can see in C form here:

        include/LibreOfficeKit/LibreOfficeKit.h

> extern "C" SAL_JNI_EXPORT void JNICALL
> Java_org_libreoffice_kit_Document_postUnoCommand
>     (JNIEnv* pEnv, jobject aObject, jstring command, jstring arguments).

        Yep - so this is not the right method =)

> I know that you don't work with Android side

        Hey ;-) I've hacked on and around the Android code a fair bit getting
that going ;-)

> but is there anyone you can address me to in order to solve this problem?

        The developers list is the best place; this is a very sensible
question, and I'm excited to have you interested in working on Android -
currently almost no-one is, so there is a big opportunity there =) There
is a lot that can be done to accelerate things on Android - particularly
eg. combined tile rendering, and there are lots of hooks we've added for
'Online' that can be mirrored nicely on Android these days - so it
should be easy to improve the editing UI a lot.

        Anyhow ... I think you prolly want to:

extern "C" SAL_JNI_EXPORT jint JNICALL
Java_org_libreoffice_kit_Office_saveAs
    (JNIEnv* pEnv, jobject aObject, jstring sUrl, jstring sFormat,
jstring sOptions)

        And pass in a file-name with a ".pdf" extension which should give you a
temporary file with a PDF in it =)

        That will call to:

        desktop/source/init.cxx:

static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl,
const char* pFormat, const char* pFilterOptions)

        Which you can read to see how it works =) Of course, in terms of a UI
to set paper size and orientation and so on - I think you'll want to use
the new UNO commands exposed for 'online' to add some options for that.

        Hope that helps !

                Michael.

--
michael.meeks at collabora.com <><, Pseudo Engineer, itinerant idiot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20161208/003ec22e/attachment.html>


More information about the LibreOffice mailing list