* @throws Exception Throws
*/
public static String xhtmlToDiff(String xhtml, int width, int height)
throws Exception {
Document doc = XMLUtil.documentFromFile(xhtml);
Graphics2DRenderer renderer = new Graphics2DRenderer();
renderer.setDocument(doc, new File(xhtml).toURI().toURL().toString());
BufferedImage buff = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR);
Graphics2D g = (Graphics2D) buff.getGraphics();
Dimension dim = new Dimension(width, height);
renderer.layout(g, dim);
renderer.render(g);
StringBuffer sb = new StringBuffer();
getDiff(sb, renderer.getPanel().getRootBox(), "");
return sb.toString();
}