I am converting a doc file to pdf format in android using the following libraries,
- IText-1.4.8.jar
- poi-3.0-FINAL.jar
- poi-notepad-3,2-FINAL.jar
here is my sample code
package com.example.converter; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import android.content.Context; import android.os.Environment; import android.widget.LinearLayout; import com.lowagie.text.Document; import com.lowagie.text.Paragraph; import com.lowagie.text.pdf.PdfWriter; import org.apache.poi.hwpf.HWPFDocument; import org.apache.poi.hwpf.extractor.WordExtractor; import org.apache.poi.hwpf.usermodel.Range; import org.apache.poi.poifs.filesystem.POIFSFileSystem; public class TestCon extends LinearLayout { FileInputStream infile; private static String FILE = Environment.getExternalStorageDirectory() + "/MyReport.pdf"; public TestCon(Context context) { super(context); my_method(context); } public void my_method(Context context) { POIFSFileSystem fs = null; Document document = new Document(); try { infile = (FileInputStream) context.getApplicationContext().getAssets().open("test.doc"); } catch (IOException e1) {
}
but i get this error
[2013-05-10 12:39:12 - Dex Loader] Unable to execute dex: Multiple dex files define Lorg/apache/poi/generator/FieldIterator; [2013-05-10 12:39:12 - converter] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lorg/apache/poi/generator/FieldIterator;
I uninstalled my android-v4.jar support. from the lib a / c folder to answer this answer, answer about the error , but I still get the same error :(
Please help me solve this problem. Anyone who has converted the document to PDF, share your code.
I will be very grateful:)
Yours faithfully
source share