0
我試圖從xhtml使用飛碟生成pdf文件你有任何想法爲什麼這段代碼總是throwx異常嗎?生成pdf文件的問題
import org.xhtmlrenderer.pdf.ITextRenderer
import com.lowagie.text.DocumentException
private void testconfiguration(String taskId) throws IOException, DocumentException {
String inputFile = "/home/marcin/firstdoc.xhtml";
String url = new File(inputFile).toURI().toURL().toString();
String outputFile = "/home/marcin/firstdoc.pdf";
OutputStream os = new FileOutputStream(outputFile);
ITextRenderer renderer = new ITextRenderer();
renderer.setDocument(url);
renderer.layout();
renderer.createPDF(os); // this line generates Exception
os.close();
}
什麼是例外? – pablochan
java.lang.NoSuchMethodError:com.lowagie.text.Rectangle.height() – CookieMonster
然後,這可能是一個庫版本問題。所以你使用的一個或多個罐子是不相容的。 – pablochan