将具有“png”格式图像文件的html转换为页面标题为pdf

时间:2012-08-13 10:20:17

标签: java css html-to-pdf xhtmlrenderer

我有一个java Web应用程序,我将HTML页面的帮助指南转换为pdf。 Html到pdf的转换工作正常但是会出现以下错误:

WARNING: Can’t read image file; unexpected problem for URI ‘http://localhost:8080/App/content/css/abc.css’
java.io.IOException: http://localhost:8080/App/content/css/abc.css‘ is not a recognized imageformat.
at com.lowagie.text.Image.getInstance(Image.java:427)
at org.xhtmlrenderer.pdf.ITextUserAgent.getImageResource(ITextUserAgent.java:67)
at org.xhtmlrenderer.pdf.ITextReplacedElementFactory.createReplacedElement(ITextReplacedElementFactory.java:40)

Core-renderer.jar我在这里使用。标题上的背景图片是通过css设置的。图像格式为“png”。

以下是HTML代码:

<html>
<head>
<link rel='stylesheet' type='text/css' href='http://localhost:8080//App/content/css/abc.css' media='print'/>
<style> #header{background-image: url(../images/help/logo.png);}</style>
</head>
<body>
<div id='header'>TEST</div>
</body>
</html>

请提供宝贵的建议。

感谢。

0 个答案:

没有答案