1

I want to run a simple iText program, here is my code: http://pastebin.com/C6YMkYNk

It is working fine with Java but not in Android. I am using iText version 5.1.3. My code doesn't show any errors but also doesn't show a PDF file. Can anyone suggest what I need to do to solve my problem?

Chris Haas
  • 53,986
  • 12
  • 141
  • 274
Aamirkhan
  • 5,746
  • 10
  • 47
  • 74
  • Please incorporate a minimal example of our source that duplicates the problem. Also, the question needs to be rewritten to make it more readable. – the Tin Man Dec 19 '11 at 05:22

2 Answers2

0

I don't think that version of the library is optimized for Android dev as it contains several libraries that do not work for Android....such as the AWT libraries.

You need to contact their sales department to find out how to get your hands on the Android library of iText

Joakim
  • 446
  • 4
  • 8
0

Try this:

FileOutputStream fOut = openFileOutput("a.pdf", MODE_WORLD_READABLE);
PdfWriter.getInstance(document, fOut);

You cant just start writing to the working directory. You have to store it on the sdcard

Steven
  • 3,844
  • 3
  • 32
  • 53
  • still not working..i have updated my code as here:http://pastebin.com/bynwweAQ ectually when i run a code in java than pdf file is automatically created – Aamirkhan Dec 19 '11 at 05:43
  • What if you only use the openFileOutput and remove PdfWriter.getInstance(document,new FileOutputStream("a.pdf")); – Steven Dec 19 '11 at 06:16
  • i tried this but & it deoesn' show any error but pdf is also not created – Aamirkhan Dec 19 '11 at 06:18
  • How do you know it's not created? (remember this will be saving it onto the device) Also make sure you're closing your output streams. – Steven Dec 19 '11 at 06:23
  • ectually it doesen't shows me any pdf file so...and ya here is my code http://pastebin.com/ryAcEpWb – Aamirkhan Dec 19 '11 at 06:29