Forum How do I...?

Can 404 errors returned from broken image links be ignored?

lee.bourne
Hi,

I'm getting the following error returned when linking images into my pdf:

prince: http:// server /image.jpg: warning: The requested URL returned error: 404

One solution is of course to ensure that the image exists but unfortunately this is not possible as I am accessing a library of millions of images where 99% are valid url's but the odd image is missing and I do not want my pdf to fail because of it. I would much rather it was either shown as a blank image or with an image of a broken link.

Is this something that can be achieved or should I put it in requested features?

Thanks,

Lee
mikeday
It is only a warning, so the PDF should still be generated. The default rule for img in xhtml.css is as follows:
img, embed {
    display: inline-block;
    content: prince-fallback(attr(src, url)), attr(alt);
    max-width: 100%
}

If you don't want to display the alt attribute text for missing images you could write your own rule like this:
img {
    content: prince-fallback(attr(src, url)), url("http://example.com/missing.gif")
}

where you can replace the example.com URL with a link to a missing image of your choice.