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 !
Migrating Whiteboard tags to Keywords: (easyHack, difficultyInteresting, skillCpp, skillJava, topicCleanup) [NinjaEdit]
JanI is default CC for Easy Hacks (Add Jan; remove LibreOffice Dev List from CC) [NinjaEdit]
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!
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 !
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!
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.
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.