Java 在android中将.docx转换为pdf文件时出现问题
我正在将.docx文件转换为pdf文件。docx文件包含文本、图像、图表,。必须将其转换为pdf文件。所以我使用下面的代码来完成我的任务。但是,它显示,“转换为Dalvik格式失败,错误为1”我使用了15个JARJava 在android中将.docx转换为pdf文件时出现问题,java,android,eclipse,pdf,Java,Android,Eclipse,Pdf,我正在将.docx文件转换为pdf文件。docx文件包含文本、图像、图表,。必须将其转换为pdf文件。所以我使用下面的代码来完成我的任务。但是,它显示,“转换为Dalvik格式失败,错误为1”我使用了15个JAR try { long start = System.currentTimeMillis(); // 1) Load DOCX into XWPFDocument InputStream is = new FileInputStrea
try {
long start = System.currentTimeMillis();
// 1) Load DOCX into XWPFDocument
InputStream is = new FileInputStream(new File(
"/mnt/sdcard/HelloWorld.docx"));
XWPFDocument document = new XWPFDocument(is);
// 2) Prepare Pdf options
PdfOptions options = PdfOptions.create();
// 3) Convert XWPFDocument to Pdf
OutputStream out = new FileOutputStream(new File(
"/mnt/sdcard/HelloWorld.pdf"));
PdfConverter.getInstance().convert(document, out, options);
System.err.println("Generate pdf/HelloWorld.pdf with "
+ (System.currentTimeMillis() - start) + "ms");
} catch (Throwable e) {
e.printStackTrace();
}
我更多地在谷歌上冲浪,我得到了很多建议,比如项目-->清理,编辑eclipse.ini,在sdk中更改proguard,…我尝试过的一切,但没有人能帮上忙。
有人能帮我吗?谢谢。最后,上述代码运行成功,但出现警告**“02-20 08:07:45.924:E/dalvikvm(9028):无法找到从方法com.example.sample.MainActivity.createPDF**引用的类'org.apache.poi.xwpf.usermodel.XWPFDocument'