1
docx 파일에서 모든 이미지를 추출하는 작업이 있습니다. 아래의 스 니펫을 동일한 용도로 사용하고 있습니다. 나는 Apache POI api를 사용하고 있습니다.JAX : docx 문서에서 푸터 이미지 추출
`File file = new File(InputFileString);
FileInputStream fs = new FileInputStream(file.getAbsolutePath());
//FileInputStream fs=new FileInputStream(src);
//create office word 2007+ document object to wrap the word file
XWPFDocument doc1x=new XWPFDocument(fs);
//get all images from the document and store them in the list piclist
List<XWPFPictureData> piclist=doc1x.getAllPictures();
//traverse through the list and write each image to a file
Iterator<XWPFPictureData> iterator=piclist.iterator();
int i=0;
while(iterator.hasNext()){
XWPFPictureData pic=iterator.next();
byte[] bytepic=pic.getData();
BufferedImage imag=ImageIO.read(new ByteArrayInputStream(bytepic));
ImageIO.write(imag, "jpg", new File("C:/imagefromword"+i+".jpg"));
i++;
}`
그러나이 코드는 문서의 바닥 글이나 머리글 섹션에있는 이미지를 감지 할 수 없습니다.
저는 Google 기술을 광범위하게 사용했으며 유용한 정보가 없었습니다.
어쨌든 docx 파일의 바닥 글 섹션에 이미지 파일을 캡처 할 수 있습니까?
머리글과 바닥 글에 [getAllPictures] (https://poi.apache.org/apidocs/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.html#getAllPictures())를 호출 해 보았습니까? – Gagravarr