Just 4 line code to convert doc to image……

Posted by
Using jWordConvert you can convert your doc to image file very easily.jWordConvert is a java library that can   read the word document,modify the word document,and convert. By applying 2 steps you can convert your doc file to png,jpg.

1. download the jar file from the site    http://www.qoppa.com/wordconvert/demo/index.html.
2. Write the code to convert doc to image:

<%@ page language=”java” contentType=”text/html; charset=ISO-8859-1″
<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>
<%@page import=”com.qoppa.word.WordDocument” %>
<%@page import=”com.qoppa.pdf.TIFFOptions” %>

<meta http-equiv=”Content-Type” content=”text/html; charset=ISO-8859-1″>
<title>Insert title here</title>
// Load the document
WordDocument wd = new WordDocument (“Java2Career.doc”);

// Save the document as a PDF file
wd.saveDocumentAsTIFF(“output.tif”, new TIFFOptions(150, TIFFOptions.TIFF_FAX_GROUP4));
// Save the first page to a PNG file
wd.savePageAsPNG (0, “page0.png”, 150);
catch (Throwable t)
} %>

Your doc is converted into image.

Leave a Reply