I'm using MuPDF to open and edit PDFs in my android application, but I need of some way to get the current page in a bitmap format.
I've been reading the code, but I've not succeed. Someone can help me?
We have a similar feature in our Android customizable magazine app, using muPDF: we generate page thumbnails in bitmap format.
This app is open source and available on Github. You can see there how we implemented this feature.
The MuPDF API is a C level one. It's certainly capable of doing what you want - see apps/mudraw.c for code that does this, or even doc/render.c.
In the example android viewer, we needed to be able to do some things from java. So, we wrapped up a small fraction of the API with jni and exposed that (see android/jni/mupdf.c). This does just enough for what we need, and nothing more.
If you want to get access to parts of the API that aren't exposed, (and it sounds to me like you do) then you'll have to wrap up that for yourself.
In an ideal world, we'd have it set up so that there was a direct mapping from java classes down to the underlying MuPDF API, but we haven't had the time/need to do that yet. If anyone out there is interested in doing such a thing, do get in touch...
Related
I'm struggling to understand how am I meant to interact with the "graph" and "calculator" stuff from the mediapipe library. More specifically, I'd like to write some Android code that uses landmarks from the holistic (pose + hands in my case) solution, with the final goal of writing a flutter application that compiles both for Android and iOS.
I've managed to build a few of the sample apps (thanks to docker), and I think I roughly understand what the graphs do. However, I don't understand how to interact with them from within the code. The Hello World! for Android tutorial doesn't really explain this. There are examples that include this type of behaviour (e.g. here), but I don't really know where is all the required information coming from (e.g. how would I find out the right functions and string constants to get holistic landmarks?)
For example, in Python I could get data via something like holistic.process(image).pose_landmarks, and then compute e.g. position or angle of hips. And as far as I can see there are some similar Android API-s available, although not for all solutions - including holistic. So what if I don't want to wait for the API-s development, and want to use the graphs instead? That part is not so clear.
As a bonus, please do feel free to drop any links which further explain/document the "graph" and "calculator" stuff I've mentioned earlier, as I've not used anything like this before and find it a little difficult to google.
Thanks.
I've realised there are docs available: https://google.github.io/mediapipe/framework_concepts/framework_concepts.html
Not sure how I've missed this...
I'm working on android application and it should allow users to take photos using camera and the application reads the text and numbers in the photo.
I don't know where to start from android studio. is there any good suggestion on github that could help me???
thanks in advance.
As others said OpenCV or OCR is the way to go.
Google maintains one OCR library called as "Tesseract" (reminds me of Avengers :P).
To make the job little easier there is a fork of Tesseract called as Tess-Two
It combines some other useful tools like Leptonica (image processing library). Build instructions are given on the Readme file.
To get started you can check out very easy to use OCR library
Easy OCR Library Android which uses Tess-Two under the hood.
Again usage instructions are in the Readme file. It is already built so you don't need to build Tess-Two.
You can try to use OpenCV library. Its abbreviature is Open Computer Vision Library. It has a reputation similar to OpenGL. There must be articles about yor issue in which library is ised. It can be linked static or dynamic using runtime application called OpenCV Manager (available in Google Play). You can use it both in Java and C++ code. Hope, it helps
PS i have an own example of it use.
https://github.com/androidovshchik/ProhibitingSignDetector
i could give suggest about how i would do that if i needed to .
first of all you need to photo the picture only black and white .
then cheack the min black pixels in row that will define a letter .(you dont want any shadow to recognize as potential letter.
try and learn progress (any camera have diffrent resulution so it need to be some % of the picture row pixels.)
after that evrey letter have diffrent shape so you need to do for loop 5 times in diffrent angel until you get to the third gap of black rows.
after that some huge switch and if to get to the right letter need to do big research about the gap inside the letter proportion.
to have a little dataBase could help if you wanted to get more then one font .
again i not sure its the right way but that what i would do.
have fun :)
You may try to find some Optical Character Recognition (OCR) library for Java
Check Java OCR, tess-two, Aprise. And explore stackoverflow searching other OCR solutions.
Implementing your own OCR lib may be very difficult so think is it really necessary for your task.
Let's start with why do I want to do that:
The project my company's currently working in, involves the possibility to have one of our client's employee to go to the end of the world, with absolutely no way of having a connection to a mobile network, taking a portable printer with him, and print a report from his tablet. We currently have a working report already being printed this way, but they added a little detail that caused lots of trouble, which is the reason I'm here, I need to put 3 charts at the end of a Jasper report.
In a web application that would be extremely easy, since Jasper itself offer this functionallity, but since it's a mobile project, we tried using PDFReporter. This API generates a PDF from a .jrxml file, but it doesn't support every single feature from Jasper, and charts are one of them. Searching the web I've found that we could export a chart to a PNG and then add it to the report, which would work with PDFReporter.
Starting today by 8am I've spent my day searching and testing different chart-generating APIs, just to discover that, so far, 100% of the android APIs are meant to generate a chart directly on a view you specified on your activity, but that doesn't work for me at all.
I've also tested a few Java APIs, but got an issue there too, since most of them use java.awt resources to manipulate images, and that package is not included in android's SDK, nor is it supported (discovered that by adding JFreeChart to my project, which made my build take about 15 minutes and in the end fail with an OOM error).
So what I need help with is: is there an API I can use directly on a mobile project, with no connection whatsoever, that generates a pie chart as a PNG without having to render it on a view and just then fetching the Image?
I'd just like to make it clear that I'm NOT 100% sure about most of the things I've said above, except for the limitations of PDFReporter, those are confirmed, so please, any kind of help will be GREATLY appreciated, even a little "that's not how it works" will help.
Thanks in advance if you at least took your time reading it :)
I am not sure why you say "... generate a chart directly on a view you specified on your activity, but that doesn't work for me at all". Everything you see of your Android app is in some View anyway (in your case it would probably be an ImageView).
Do you just want to generate the chart as a PNG in memory and store it or manipulate it further? In that case, you could first generate it in a hidden ImageView using the API of your choice, then extract it using ImageView.getDrawable() for example. Assuming the API has no problem with the view being hidden. Maybe this helps
I'm trying to create an active reading application prototype for my course project in Android platform. I'm new to Android SDK, and I cannot figure out how to use WebView's native functions, because I need to use them to implement selecting / highlighting / copying texts using gestures. I saw that WebView has a function setSelection but it's private and I cannot use it.
But I think may be there is something that I miss. May be I need to use something else. Please, give me some suggestion, links, books where I can find useful information.
I wanted to plot a stock historical graph based on google finance in my android app .
The problem is I can't find the api for just the stock chart alone and I must try to find another ways to do it.
I thought of a way but don't know what whether it works
the steps are as follows..
1) get the details from csv file
2) read the csv file
3) plot the graph using the information of the csv file.(WHICH I DON'T KNOW HOW TO DO IT)!
so if my steps above works , I would only want to know how to plot the graph.
Use Charting Libraries like JFreeCharts, JOpenChart (google for more)
They include samples on how to use them...
Or You could use Google's Charting API's
Neither JFreeCharts nor JOpenChart has not been ported to Android (as far as I know) and will not work on an android as-is, not will any other awt/swing based api due to differences in their respective Canvases etc. You could try porting one yourself but its not as trivial as it sounds and you probably won't be happy with the results.
I suggest using a library written from the ground up for Android which has support for the kind of plot you need. I recommend AndroidPlot but there are others out there as well.