I just want to view them not work on them so I don't mind an ipynb to PDF or HTML converter on android
I usually just convert them from my laptop or upload them to colab before printing them as PDF but those options aren't available to me right now, any app suggestions methods are welcome.
There are ipynb viewers available on playstore, although I have not tried them.
I generally just change the extension to txt from ipynb, but this will give you a bunch of currently useless information also.
Related
I plan to use the built-in android pdf library. In my app I need to display a pdf report that may consist of several pages. Users should be able to print those pages. Printing with the PrintDocumentAdapter seems pretty straight forward, but what's unclear to me is what is the best way to create the pdf. I know that you can generate a PdfDocument with simply a View/canvas and or take more "low-level" approach where you draw lines,text, paint, etc.
I see three possibilities:
Create a view for each page. The user can navigate between the views as needed and print. However it's unclear to me how to generate a pdf for each page/view. What I mean by this is if I'm viewing page/view 1, yes I can easily create a pdf from this, but what about the other pages? Yes I can have this in memory, but what I've found is if they aren't actively being displayed on screen, they create empty pdfs. I don't want to have the user print each page individually.
Create the pdf documents (low-level approach), integrate a pdf reader and just display/print the pdf from there.
Create a view for each page that the user can navigate through. When the print option is invoked, generate the pdf documents again (low-level approach)
Obviously option 1 is the preferred approach, but I'm not clear on how I can do that. Of course, I could be missing something here so any help would be appreciated!
Android didn't have built in pdf genaration library, but in API19 android provided an api https://developer.android.com/reference/android/graphics/pdf/PdfDocument.html
But as #Ivan Wooll said itext is a nice pdf generation library if you want to use.
...but what's unclear to me is what is the best way to create the pdf...
Yet, it is relative. It really is a matter of what library/framework you find more convenient to work with, because each of them offers quit the same functionality with its own disadvantages. For instance, those I worked with, have the following ones:
iText - you must buy a licenece for comircial use (see What is latest version of itext that is not AGPL?);
Android Print Framework - no built-in pdf preview before printing as you mentioned in the 2nd item (you can use built-in PdfRenderer though for API 21+; also see Display PDF within app on Android?). Another disadvantage is the disturbing system dialogs when you'd like to save/print "silently" :)
Even the official documentation states that "You can use any PDF generation library to generate a PDF document and pass it to the Android print framework for printing."
...Yes I can have this in memory, but what I've found is if they aren't actively being displayed on screen, they create empty pdfs...
The reason for empty pdfs when you keep the views that have been left by a user in memory is their 0-dimension because of not being laied out (see Android: PdfDocument generates empty pdf). The same will happen if you try to inflate the views that haven't been reached by a user yet... In fact, there is nothing you can do about it, this is how Android works.
I don't want to have the user print each page individually.
In this case I suggest you to create pdf pages in advance for each content view a user is currently interacting with, just make sure that the view is still laied out when drawing it on canvas. For the views that aren't currently laied out use the "low-level approach". And once printing requested pass the output pdf to Android Print Framework.
There are a few pdf generation libraries out there. Itext being the simplest to use but it's ludicrously expensive. Pdfjet is another one which is reasonably priced. A quick google will provide you with more i'm sure.
I'm working in an app, and I need which the app can generate a PDF file with the app data saved in XML's.
I need make this in one of two ways, but I don't know how, the ways are:
Generate a PDF from a existing HTML
Edit an existing PDF and add text.
I don't know how iText or droidText can help me.
Any suggestion?
How about having a look at this StackOverflow post?
Android - how to convert html to pdf?
I'm guessing your question requires a similar, if not exactly identical approach.
(By the way, performing a Google search on "generate PDF from HTML android" yielded 305,000,000 other results, many of which seem legitimate answers on your question...)
Hello Fellow Developers,
I am developing a PDF annotation for Android Tablet and would like to open/display PDF file within my android application to edit. I have done research on how to open PDF file and most methods and libraries suggest to convert the PDF to a image file. I don't want to convert to image file because the image file pixelate when I increase resolution. Now the problem I am facing are.
1) Which method I must use to display the pdf file within my application to annotate
2) I also want to implement text reflow in my app
Please suggest.
Thank you.
Regards,
Marcello
If you will read pdf file specification, you will find, that pdf have no any type of flow. Actually each letter just is strictly coordinated on a page. Therefore:
It is simple to annotate any content of pdf document by the coordinates the mark on an any rendering content.
It is impossible to use pdf as a "what you see is what you get" editor. Even it is impossible to perfectly correct parse pdf to editable and back. It is the basically WRONG idea to do, because PDF is just the representation, not the design.
Funniest part of the pdf is text. Especially - unicode text. I want to say, that catching non-english text from the pdf file will return unpredictable results.
Thank you!
I want to show pdf file in android, but this must work without Internet connection and other appliacation. Can I show pdf file in webView or other view?
Yes you can show your PDF to your custom view. For, this you've to use one External Jar file for that. I've already answered like similar to your question. Just check it out.
Hope this helps you.
Using another app to display your PDFs is a really nice way to do it. Unless you have superiors forcing you to avoid other apps, I'd do it that way. There are good, free pdf viewing apps available so it won't cost your users anything.
The transition when opening a pdf in another app is pretty seamless and it's not always obvious that another app is being used.
The alternative, as SpK said, is to use a jar and write the extra pdf viewing functionality that you need. This is a much harder way to do it.
I have an android app where I will be capturing various information in different forms and storing into the SQL lite database for tracking/viewing purposes. I want to give the option of exporting the information into a RTF/PDF/Doc and give the option of sending it thru email.
I looked at various similar questions posted here earlier but didnt get a definitive answer. I saw the Android PDF Writer library http://sourceforge.net/projects/apwlibrary/ but this seems very basic. I considered iText but I think there would be issues with licensing if in future I want to sell this app..
Basically I want to define a template document with a structure that will be copied and content added to it based on what the user wants to export...
Any help is greatly appreciated...
I wanted some elegant solution where I can store a template in the assets folder and replace whatever I want to create the output document. Finally I went with html. I created a html template and put it into the assets folder. After that it was as simple as read assets, read db, do string.replaceall and write the output html and email it out.....
OpenOffice.org's Universal Network Objects (UNO) interface to programmatically generate MS-Word compatible documents (*.doc), as well as corresponding PDF documents.
its basically java so it should work on android too.