Not able to run simple program of iText library in

2019-03-02 13:32发布

问题:

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?

回答1:

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



回答2:

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



标签: android itext