我正在编写一个java代码,利用Apache-poi读取ms-office .doc文件和itext jar API来创建和写入pdf文件 . 我已经读完了.doc文件中打印的文本和表格 . 现在我正在寻找一种能够读取文档中所写图像的解决方案 . 我编写如下代码来读取文档文件中的图像 . 为什么这段代码不起作用 .
public static void main(String[] args) {
POIFSFileSystem fs = null;
Document document = new Document();
WordExtractor extractor = null ;
try {
fs = new POIFSFileSystem(new FileInputStream("C:\\DATASTORE\\tableandImage.doc"));
HWPFDocument hdocument=new HWPFDocument(fs);
extractor = new WordExtractor(hdocument);
OutputStream fileOutput = new FileOutputStream(new File("C:/DATASTORE/tableandImage.pdf"));
PdfWriter.getInstance(document, fileOutput);
document.open();
Range range=hdocument.getRange();
String readText=null;
PdfPTable createTable;
CharacterRun run;
PicturesTable picture;<