如何从字(DOC)文件中读取图像,并将其添加到pdf文件?

问题描述:

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

I have a doc file that contains text,images etc etc.

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

Now I want to read that doc file and write those contents into pdf file. My DOC file and newly generated PDF file has to be same.

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

I repeat, My DOC file contains ( "images as well as text" data ).

如果任何人有这个code,请帮助我。

If anyone have this code please help me out.

感谢您这么多的时间。

您可以使用此code,从文档中获取的所有图像。

You can use this code to get all the images from your document.

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();