Bug 89860 - Ability to print from Android ...
Summary: Ability to print from Android ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Android Viewer (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:6.2.0
Keywords: difficultyInteresting, easyHack, skillCpp, skillJava, topicCleanup
Depends on:
Blocks:
 
Reported: 2015-03-06 11:53 UTC by Michael Meeks
Modified: 2018-10-31 01:33 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Meeks 2015-03-06 11:53:35 UTC
The viewer can render things beautifully - even without editing it would be lovely to be able to print a document. Modern Android's have a print API that is PDF based:

https://developer.android.com/reference/android/print/package-summary.html

Which should fit well into our model. The existing android viewer is in:

android/experimental/LOAndroid3/

It would be great to add a print item (as of writing there is no toolbar there) - so a context-menu item to do this might be good. Then some coupling of the code up to:

vcl/source/gdi/pdfwriter_impl.cxx or vcl/generic/print/genprnpsp.cxx - via the headless backend we use: vcl/headless/*

would be amazing =)

Thanks !
Comment 1 Robinson Tryon (qubit) 2015-12-13 10:13:48 UTC Comment hidden (obsolete)
Comment 2 Robinson Tryon (qubit) 2016-02-18 14:51:26 UTC Comment hidden (obsolete)
Comment 3 Rosen Silva 2016-08-26 17:59:01 UTC
I would like to add the printing option to the android Viewer, can someone please give me the code pointers and also some starting guide to how to use PDF printing API to this Android Viewer.
Thanks!
Comment 4 Michael Meeks 2016-08-29 01:16:41 UTC
Hi Rosen; I guess you'll need to experiment. The LibreOfficeKit API - which you'll want to expose the file format conversion pieces (to PDF I guess) in: desktop/source/lib/lokandroid.cxx - and ensure that the relevant page / paper sizes are pushed into the filter options somehow (I guess). And invoke those in the Java in android/ at the right place.

Since the easy hack was filed the android code moved to:

android/source/src/java/org/libreoffice/

in the source tree. I imagine that streaming direct to PDF and pushing that to the Android print API is by far the best approach; which would mean you can ignore the vcl/source/gdi/pdfwriter* code pointers.

Thanks !
Comment 5 Gautam Prajapati 2017-02-13 17:03:14 UTC
Hi Michael

I'm working on this feature. As you said the best approach would be to stream the file to PDF and push it to Print API. I have gone through the documentation of Print API of Android, have already written code for printing a PDF document. 

I'm a bit new to JNI. I found the lokandroid.cxx and went through the code. I can see the methods to get document type, sizes. I'd appreciate some inputs on how can I go ahead and use those methods to push relevant data into the filter options.

Thanks!
Comment 6 Gautam Prajapati 2017-08-24 13:03:49 UTC
Update: We probably have some services on Android side missing to implement this feature right now. It's almost complete, just need to identify missing implementation in the native code.
Comment 7 Commit Notification 2018-08-15 19:03:25 UTC
Mert Tumer committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=6ede90a790ce08330af58f81474c103ee1ca438f

tdf#89860 ability to print from Android Viewer

It will be available in 6.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.