html2ps + ImageMagick + libwww-perl不能一起工作

时间:2022-05-03 09:00:36

Summary:

I am using html2ps to convert an html document with inline images. (I have both ImageMagick and libwww-perl installed.) If the images are local, this works fine; however, when the images are given through a URL, I just see [IMAGE] instead of my image.

我使用html2ps转换带有内嵌图像的html文档。 (我安装了ImageMagick和libwww-perl。)如果图像是本地的,这样可以正常工作;但是,当通过URL给出图像时,我只看到[IMAGE]而不是我的图像。

I also tried using wget instead of libwww-perl, with the exact same result. Any help is greatly appreciated.

我也尝试使用wget而不是libwww-perl,结果完全相同。任何帮助是极大的赞赏。


Code:

I always compile with

我总是编译

html2ps -d example.html > output.ps

I have the same image file in two places: ./local.png and http://www.example.com/remote.png.

我在两个地方有相同的图像文件:./ local.png和http://www.example.com/remote.png。

The following html inserts the image into the ps document:

以下html将图像插入到ps文档中:

<img src='local.png' />

but this line just inserts the word [IMAGE]:

但是这一行只是插入了[IMAGE]这个词:

<img src='http://www.example.com/remote.png' />

The output I'm getting is

我得到的输出是

html2ps version 1.0 beta7
Reading example.html
Image: local.png
convert /var/tmp/aaaVtaOy5 /var/tmp/aaaVtaOy5.ppm
Size: 8*10
Image: http://www.example.com/remote.png
Retrieving http://www.example.com/remote.png

and a local copy of the image is created.

并创建图像的本地副本。

1 个解决方案

#1


html2ps requires that remote documents include their HTTP headers. I got it to work by using wget instead of libwww-perl:

html2ps要求远程文档包含其HTTP标头。我使用wget而不是libwww-perl来使用它:

geturl: "wget --quiet -O - --save-headers";
libwww-perl: 0;

It seems that this is still probably not the best solution.

看来这仍然不是最好的解决方案。

#1


html2ps requires that remote documents include their HTTP headers. I got it to work by using wget instead of libwww-perl:

html2ps要求远程文档包含其HTTP标头。我使用wget而不是libwww-perl来使用它:

geturl: "wget --quiet -O - --save-headers";
libwww-perl: 0;

It seems that this is still probably not the best solution.

看来这仍然不是最好的解决方案。