I'm trying to draw my html formatted string into a pdf file for my android app, but the result is just the non formatted string with all the html tags visible.
Is there a way I can properly format the pdf file without using any external libraries? I can't use any for the app.
Or is there a way to convert an html file to a pdf file?
Is there a way I can properly format the pdf file without using any external libraries?
Not in any practical sense. If you have a large team or lots of time in which to write your app, you are welcome to write your own PDF generation code, as yms suggests in a comment.
Note that API Level 19+ has some HTML->PDF code in it, for the use in the printing framework, but it is not designed for generating arbitrary PDF files.
I can't use any for the app.
Then you cannot write any apps for Android, as every Android app involves libraries. The Android SDK is a library, for example.
Related
I am working on an application where I need to show PDF files from local storage. Currently I'm using this com.github.barteksc:android-pdf-viewer:2.8.2 library to read PDF files.
After build a release apk I got surprised that - my app size increased 22.6MB after using this library.
I have also searched in Android official docs for a better solution. I got PdfRenderer class. Unfortunately, this class added from API level 21. But my app minSDKVersion is 14.
How can I reduce apk size with pdf reader functionality? Or Is there any light-weight pdf library to read pdf files in Android?
Alternative for this SDK is opening the PDF in a webview - possible solution.
I need to show the pdf and the word files from the sdcard into the application.
I am looking out for libraries that can be integrated for this.
There are a few which I surfed:
1) Vudroid
2) jBlough
3) apdf and so on...
4) olive (for word)
I need a library which can show both these formats or either of the two.
Secondly, which one would be a better to go with. I was unable to find the libraries apart from the jBlough and olive. Can somebody aid me with few links for these libraries?
Note: I am not looking for implicit intent.
You can use Document Viewer and Converter for Android. It is MIT licensed Android application that can view Microsoft Word, RTF and OpenDocument Text files and convert them to PDF, DOCX, DOC, ODT, RTF and HTML.
The application uses Aspose.Words for Android to process, render and convert the documents and uses some basic Android platform's features to lazy-load and cache page previews.
Disclosure: I am a developer at Aspose.
Check out this library:
http://www.csr.com/products/directoffice-mobile-sdk
It will convert Office and PDF to PNG or PDF. The PNG files are easy to display in your app.
I want to show a pdf (preferably) or a word document in my app; like a privacy notice screen. Many applications have it, so it should be possible. i tried loading a simple text file as a start but doesn't provide formatting, fonts or trade mark symbols. I've gone through a few posts but I couldn't apply it to my app. Could anyone tell me how is it done? Could I store the file somewhere in res folder and provide a path to open it through my code? I looked into the following link but I'm not sure if that's the right approach in my case android: open a pdf from my app using the built in pdf viewer.
Android does not support opening PDF and DOC files natively. You'd have to make your own implementation.
Like t0mm13b said, you should consider using HTML (+ CSS) instead and use a WebView.
I read in some blog post that OpenXML4J have a Android Library for reading .DOCX file in Android and with help of that we can easily edit, read and create DOCX format.
My questions are:
Is it possible?
Using same code as I use in OpenXML4J will create DOCX? Is there a library in DocX4j for android?
From my experience I am pretty sure this should be all possible. And you do not need an android specific jar a regular one works fine since its the same java working on it
I need to check if a Richmedia content (video embedded in a pdf file) is available in a pdf file or not via mupdf library for an android application.
If it is then I need to retrieve the stream content via pdf parsing and convert in to a byte array and run the video found in the pdf.
Is this possible?
MuPDF does not support embedded video. You can still use the library to examine the PDF object structure and extract data streams from PDF files. Look at the "pdfshow" and "pdfextract" tools for inspiration.
You could try using iText for android, although it seems to be a constrained version. There is a post on how to extract media objects from pdf files with iText here.