Skip to main content

How to create PDFs in Android SDK?



is there any way to create create PDF Files from an android application? So far I've found nothing short of writing all the code from scratch.





Is there any API I can use, that works on android?





Thanks in advance.



Source: Tips4all

Comments

  1. I love when you guys respond with fancy paragraph that boils down to "No, that's COMPLETELY impossible... and you sir are an idiot for asking. Instead, you should change architecture of your application, just so my answer can be relevant".

    Especially in situations when there is a simple answer to what person is asking - if anyone wants to generate PDFs on Android device, here is how to do it:

    http://sourceforge.net/projects/itext/ (library)

    http://www.vogella.de/articles/JavaPDF/article.html (tutorial)

    http://tutorials.jenkov.com/java-itext/image.html (images tutorial)

    ReplyDelete
  2. I would recommend you set up a Web service and have the device use the Web service to generate the PDF. PDF creation is going to be very slow on a device, even if you can find a Java library for it that works on Android. You also then have greater flexibility in terms of languages and libraries for the PDF creation (e.g., use Prawn for Ruby), since you're doing the PDF creation on a server.

    ReplyDelete
  3. I recently faced a similar issue and decided to port an older version of iText (http://sourceforge.net/projects/itext/) to be able to create pdf's. I successfully ported the core of the last LGPL version of iText with some code from bouncycastle and Apache Harmony to Android.

    I released a first alpha of the project at http://code.google.com/p/droidtext/. It is available under LGPL like the projects it is based on.

    I am already using it in on of my projects and it works very well so far.

    Check it out. Any feedback is welcome

    ReplyDelete
  4. Late, but relevant to request and hopefully helpful. If using an external service (as suggested in the reply by CommonsWare) then Docmosis has a cloud service that might help - offloading processing to a cloud service that does the heavy processing. That approach is ideal in some circumstances but of course relies on being net-connected.

    ReplyDelete

Post a Comment

Popular posts from this blog

Why is this Javascript much *slower* than its jQuery equivalent?

I have a HTML list of about 500 items and a "filter" box above it. I started by using jQuery to filter the list when I typed a letter (timing code added later): $('#filter').keyup( function() { var jqStart = (new Date).getTime(); var search = $(this).val().toLowerCase(); var $list = $('ul.ablist > li'); $list.each( function() { if ( $(this).text().toLowerCase().indexOf(search) === -1 ) $(this).hide(); else $(this).show(); } ); console.log('Time: ' + ((new Date).getTime() - jqStart)); } ); However, there was a couple of seconds delay after typing each letter (particularly the first letter). So I thought it may be slightly quicker if I used plain Javascript (I read recently that jQuery's each function is particularly slow). Here's my JS equivalent: document.getElementById('filter').addEventListener( 'keyup', function () { var jsStart = (new Date).getTime()...

Is it possible to have IF statement in an Echo statement in PHP

Thanks in advance. I did look at the other questions/answers that were similar and didn't find exactly what I was looking for. I'm trying to do this, am I on the right path? echo " <div id='tabs-".$match."'> <textarea id='".$match."' name='".$match."'>". if ($COLUMN_NAME === $match) { echo $FIELD_WITH_COLUMN_NAME; } else { } ."</textarea> <script type='text/javascript'> CKEDITOR.replace( '".$match."' ); </script> </div>"; I am getting the following error message in the browser: Parse error: syntax error, unexpected T_IF Please let me know if this is the right way to go about nesting an IF statement inside an echo. Thank you.