Is there any function in Android to add PDF files? - java

I am making an Android app which will contain several PDF files, so that when I share this application with my friends they must be able to download these PDF files. But I am unaware of how to add PDF files in Android applications. Is there any function to do so?

Webview would be the easiest form of PDF viewing. Maybe start from there and work yourself up to something more demanding.

Related

Download all google sheet pages as JSON using link

I haven't been able to find a way to download all pages of a the sheet.
Right now I'm using this link to download the sheet as a txtfile (later I modify it easily to be compatible with JSON): https://docs.google.com/spreadsheets/d/PAGELINK/gviz/tq
This only downloads the first page of the sheet. Is there a particular link where I can download the WHOLE sheet (all pages)?
I'm not using google-sheets-api.
EDIT:I am trying to download it through my android app. Sorry if I was not clear.
At this time there is not a build-in single "link" to download all the sheets in text format but you could create an app that provides that. One alternative among others is to create web app by using Google Apps Script.

Converting .swf files to animated gifs in Java

I have a bunch of banner files in .swf format. I ultimately want to place these inside a pdf using Java. I have been successful in putting jpegs inside a pdf in Java so far.
I want to know the following things:
Is it possible to place the banner files(.swf) in a pdf using either standard java or an external library.
If the above is not possible, is it possible to convert these files into animated gifs(again with standard/external java libraries) and put it in the pdf.
I would atleast like to extract a frame from these .swf files and use it as a jpeg in my PDF.
Some PDF reader may read the swf, like Acrobat, but most won't.
You'd better be converting them.
Here is some external tools that can help you in the process: http://www.swftools.org/
As of making that with native java, it is possible, but it would require re-rendering all the SWF vector drawing, which is a quite heavy work.

How to create my own custom file type containing an image or an audio file

I want to find a way to save captured picture and recorded sound in custom file-type(s) then open them in my app. I don't want to other apps could open my files (for example gallery app don't open my pictures).
Is there any way to encode and decode my files in my app for example by writing a string at end of files.
Thanks
There is no need for custom file types. If you save your files in Internal Storage, no other application can access them. You can also save files in the External Storage that are private, by calling getExternalFilesDir().
Details are here: http://developer.android.com/guide/topics/data/data-storage.html#filesInternal
Use a file extension no one else uses, then use this answer to open all such files with your app.

How to import files to iPhone file system for use in app?

I'm trying to develop an iPhone version of an Android app I made. In the Android version you can import spreadsheets to use as templates into the app by copying the file into your sd card from your computer and loading it through an open file dialogue through the app. What would be the a similar way I can do this for non-jailbroken iPhones and iPads to achieve this same functionality?
My goal is to do this without the use of a second app to import them; etc.
You can use file sharing. To activate it you have to check UIFileSharingEnabled in your plist file. And you cad drag files to your document directory and out of it via iTunes. You can even specify what data types your app wants to support and you can even register the app to open specific file so if someone, for example send you an email with this file you can press on the file attached and if your app is installed on the device you will be able to use your app to open this file.
What are the type of your file ?.
You can use the UIWebView to display files with this extensions :
Excel (.xls)
Keynote (.key.zip)
Numbers (.numbers.zip)
Pages (.pages.zip)
PDF (.pdf)
Powerpoint (.ppt)
Word (.doc)
Where to store your file ?
It depends of your business and your application.
You can store it in a server and the application can load it.
You can store it in the Application sandbox.
For example, you can store it in the application's bundle and use this code to laod your file and display it in a UIWebView :
NSString *path = [[NSBundle mainBundle] pathForResource:documentName ofType:nil];
NSURL *url = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView loadRequest:request];
I am not sure I understand your question but have you consider converting your spreadsheet do a .csv file?
After that you can read your csv and transform it into array.
Take a look at this tutorial. It has code that converts a CSV into arrays of the strings in each column / row.

Multiple file uploader with previews

I'm trying to find something that will let users upload multiple files to a website. The requirements are that it let them easily select multiple files (preferably with something like check boxes) and that it displays a preview of the images they select.
I'd prefer to only use Javascript or Flash if possible, but Java is also an option (this needs to work on platforms where Silverlight isn't available).
So far all I've been able to find are things that use the native file selector (which doesn't show previews on Windows, and makes it unclear that you can select multiple by holding ctrl).
I'm not sure if the preview requirement is even possible, but it's the most important.
This is a firefox solution:
It uses the FileReader javascript object to load, display and upload images.
http://hacks.mozilla.org/2011/01/how-to-develop-a-html5-image-uploader/
It still doesnt show previews in the FileSelection dialog but at least allows you to preview the images before uploading.
And here is a ready made java applet solution:
http://jumploader.com/doc_overview.html
To upload multiple files I use RichFaces rich:fileUpload component.
Concerning the preview, I've got the similar problem and the best I found after couple of days of googling is following.
Alfresco has the same problem and resolved it with :
An open office which runs in server mode (socket) and all the office documents are sent by alfresco to open office in order to convert them in PDF
Those PDF are converted to .swf viewer thanks to SWFTOOLS
This .swf is integrated in the HTML
For images, it uses ImageMagick to create small version of the file I suppose
Personnaly, I will try to implement it this way :
Converting office documents to PDF thanks to open office in socket mode
Transform the first page of the PDF into a PNG thanks to JPedal library
Diplay that PNG to the end user
For images I would perhaps use ImageMagick too ... but for now, I'm using Seam Image.scaleToFit API
I am assuming 2 things here:
1) Some kind of client/enduser will be doing the file upload
2) You get some kind of say on what the client installs on their computer to help make this happen.
If this is the case, my first suggestion would be:
Give them FTP or SFTP client software to upload files. The php page you make can have a link to Filezilla, along with instructions on how to use it. ftp and sftp are THE protocols to use for transferring files. HTTP is just not designed(well) for it, nor are browsers.
Once the user has the (S)FTP client software installed, you can give them URL's to upload files to that are specific to their user account, and you can have a backend script process and load/move files that they upload. It's pretty easy to create a local temporary directory using a server side script, have the client upload files via ftp, then go back to the web browser and click a button that says "Done uploading, please process my stuff".
The browser can even give back confirmations on everything that gets uploaded/processed.

Categories