How to extract image with text and convert into pdf file in java -
How to extract image with text and convert into pdf file in java -
i have extract image text doc file , convert pdf file in java. , same time want swap images of doc file images while converting pdf.
bundle com.test.demo; import org.apache.poi.poifs.filesystem.*; import org.apache.poi.hwpf.*; import org.apache.poi.hwpf.extractor.*; import java.io.*; public class readdoc { public static void main( string[] args ) { string filesname = "hello.doc"; poifsfilesystem fs = null; seek { fs = new poifsfilesystem(new fileinputstream("sai_international_automation.doc")); //couldn't close braces @ end site did not allow close hwpfdocument doc = new hwpfdocument(fs); wordextractor = new wordextractor(doc); string[] paragraphs = we.getparagraphtext(); system.out.println( "word document has " + paragraphs.length + " paragraphs" ); for( int i=0; i<paragraphs .length; i++ ) { //paragraphs[i] = paragraphs[i].replaceall("\cm?r?n",""); system.out.println( "length:"+paragraphs[ ].length()); } } catch(exception e) { e.printstacktrace(); } } }
above code giving error:-
java.io.ioexception: invalid header signature; read 0x342e312d46445025, expected 0xe11ab1a1e011cfd0 @ org.apache.poi.poifs.storage.headerblock.<init>(headerblock.java:140) @ org.apache.poi.poifs.storage.headerblock.<init>(headerblock.java:104) @ org.apache.poi.poifs.filesystem.poifsfilesystem.<init>(poifsfilesystem.java:138) @ com.test.demo.readdoc.main(readdoc.java:15)
java pdf doc
Comments
Post a Comment