There is a android app named taaghche which you can purchase and read pdf books etc...
I purchased a book and I want to be able to read it on PC not android, and also be able to highlight the text (which is not allowed in the app), But The app stores the pdfs so that the pdf files only opens in the app itself and if you try to open the pdf in another device you'll get the error:
Note that the app actually stores the pdf along with a file with no extension and the same name.
I think the app uses the file with no extension to give permission to the pdf file to be opened.
Here is the two files in a zip to download and have a look.
http://langfox.ir/download/pdfs.zip
Any idea or solution or clue to open this file is greatly appreciated.
The pdf looks encoded/encrypted (I maybe wrong) but I would expect to see a Pdf header, and I don't.
The file without an extension is a JFIF file (JPEG File Interchange Format), if you change the extension to Jpg, or JFIF, you should be able to view it as an image. Or in C# you can just use the Bitmap or Image class to load it
Image.FromFile(theFileName);
Related
Is there any way in which we can restrict the user to upload files (PDF, Docx and Images) from downloads folder only? Like he can't see any other directory from he can choose a file from? Actually I have made an app in which pdf files are not getting the right path for WhatsApp Documents and docs in Recents folder on android 11 I have tried many solutions but nothing helped. So I am thinking if we can restrict the user to Downloads only?
So i have to make an android app using Java that reads a PDF File and displays it on screen without using other programs(such as PDF Reader). How to make a distinction between text and image in that file? in other words, there is text and in between text ther is an image, how do i verify where it is text and where is an image?
PDF files don't work like that.
It is a complex format, and there is a lot more data in the files than just text and images, such as metadata and formatting.
If you want to handle PDF files in your app, you should use a PDF library, such as the ones listed here:
https://camposha.info/android-examples/android-pdf-libraries/#gsc.tab=0
How exactly to load text will depend on the specific library you choose, and you should check the relevant documentation.
I am maintaining a legacy Java / C++ application for Android which is backwards compatible to some API 18. It contains a rudimentary e-mail client.
Users receive e-mails with various attachments (HTML, PDF, JPG, MP3, MP4, XLS) and want to be able to open them in external applications. Prior to Android Q, I just saved the attachments to disk and invoked an intent with ACTION_VIEW on the file:///uri to the saved attachment.
This stopped working in Android Q with the new restrictions on storage access. Even if I save a HTML file to, say, Download/ directory, Chrome won't open it from an ACTION_VIEW intent: the error is ERR_ACCESS_DENIED.
I don't know how to fix this problem with the new scoped storage. Is there even a unified way how to open file types as different as PDF, HTML, JPG, MP3, MP4, XLS in external applications using intents? Or do I have to branch my code according to the type of the media and use some different approaches and directories for images, sounds, video and documents?
Is ACTION_VIEW still universally capable of opening files such as HTML, or has it been restricted to media files only? I would be happy to have an universal way of opening all temporarily saved attachments (smaller code to maintain is always better), but I am not sure if it is possible at all anymore.
Any help is appreciated.
Using Android PrintManager API user can save content as PDF into device's internal/external directory.
I need to get that PDF file's path as soon as it is created. Is there any way to do this directly without having to use a file chooser?
Any ideas are appreciated.
Using Android PrintManager API we can save content as PDF into device's internal/external directory.
No. The user can elect to send your print job to a PDF file that is stored locally. The user could elect to do something else:
Send it to an actual printer
Send it to something else (e.g., Cloud Print)
Abandon the print job
Is there any way to do this directly without having to use a file chooser?
No, simply because there is no requirement for the user to save the content to a local PDF file in a place that you can access. In addition to all the above non-PDF alternatives, the user could save it as a PDF to removable storage, in a directory that your app cannot access.
I need to get that PDF file's path as soon as it is created
Then the PrintManager API is not suitable. Generate a PDF some other way (e.g., iText).
Our project has an image uploading module using Java. While uploading image, if a user uploads an image with an extension of jpg/jpeg/gif/png etc., whatever the extension, we save it with same extension by changing just its name.
But here is one small issue. Suppose the user removes the extension of that image manually (of course it never happens, but let's consider it as example) and uploaded the file, it doesn't have any extension.
Is there any way to find out extension/format after reading that image (like after reading the image using getBufferedImage())?
Here I can't use mimeType as we are taking mime type from user while uploading image itself. The user may upload image without an extension, by selecting the mimeType as "image/jpeg".
There are java libraries like mime-util or jmimemagic that can detect the file type from the pure content.