我无法使用phantomjs正确渲染存储在服务器中的某些图像。如果我使用存储在互联网上的任何其他图像都能正常工作。所以我想知道是否有人可以告诉我一些我应该设置的服务器配置。
我有这个phantomjs脚本:
page.open(html, function () {
window.setTimeout(function( status ) {
page.clipRect = { left: 0, top: 0, width: 640, height: 800 };
page.render(outputFolder + htmlBaseName + '.png');
console.log('rendered');
phantom.exit();
}, 2000);
});
还有一个包含表和这些图像的html文件:
<img src="http://myServerURL/image1.png" style="width: 198px; min-height: 181px; max-height: 181px; height: 181px; max-width: 198px;" width="198" height="181">
<img src="http://myServerURL/image2.png" style="width: 198px; min-height: 181px; max-height: 181px; height: 181px; max-width: 198px;" width="198" height="181">
<img src="http://phantomjs.org/img/phantomjs-logo.png" style="width: 198px; min-height: 181px; max-height: 181px; height: 181px; max-width: 198px;" width="198" height="181">
而且我得到的回报是:
可以从互联网上查看我的图像
我无法使用phantomjs正确渲染存储在服务器中的某些图像。如果我使用存储在互联网上的任何其他图像都能正常工作。所以我想知道是否有人可以告诉...
如果要在PDF中呈现本地图像,则必须将该图像转换为base-64并在img标签的src属性中传递此值。