Flying Saucer:将html转换为pdf花费很长时间并且图像没有渲染

时间:2014-11-26 02:25:13

标签: java pdf flying-saucer

我使用Flying Saucer库将html转换为pdf。它过去工作正常然后突然有一天转换无法在输出pdf文件中呈现任何图像。下面是我用来将html转换为pdf的方法:

public static void convertHtml2Pdf(String htmlPath, String pdfPath) throws FileNotFoundException, IOException, com.lowagie.text.DocumentException {

    final ITextRenderer iTextRenderer = new ITextRenderer();


    iTextRenderer.setDocument(htmlPath);
    iTextRenderer.layout();

    /** The generated pdf will be written to the file. */
    final FileOutputStream fileOutputStream =
                new FileOutputStream(new File(pdfPath));

    /** Creating the pdf */
    iTextRenderer.createPDF(fileOutputStream);

    fileOutputStream.close();
}

我的调查显示代码永远停留在iTextRendered.layout()。有没有人遇到过这个问题,并且知道如何解决这个问题?感谢。

0 个答案:

没有答案