html2ps + ImageMagick + libwww-perl not working together

400 views Asked by At

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.

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


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.

The following html inserts the image into the ps document:

<img src='local.png' />

but this line just inserts the word [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

There are 1 answers

0
Kittsil On

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

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

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