-2

我有一个包含文本、图像等的 doc 文件。

现在我想读取那个 doc 文件并将这些内容写入 pdf 文件。我的 DOC 文件和新生成的 PDF 文件必须相同。

我再说一遍,我的 DOC 文件包含(“图像和文本”数据)。

如果有人有此代码,请帮助我。

非常感谢您的参与..

4

1 回答 1

0

您可以使用此代码从文档中获取所有图像。

HWPFDocument doc = new HWPFDocument(fs);// fs is the object of POIFSFileSystem 
Range range = doc.getRange();
PicturesTable pt = doc.getPicturesTable();
List<Picture> listPic = pt.getAllPictures();
Picture pic = listPic.get(0);// iterate listPic upto its size to get images
byte[] picArr = pic.getContent();
于 2013-09-12T11:21:59.550 回答