Forum How do I...?

Remote CSS inclusion

gribouille
Hi,

We've bought server licence for Prince and we have some troubles with PDF generation when we have a remote CSS stylesheet.
What we found amazing it's when we have an URL for a pic with http://... the pic inclusion is ok, but when we do a such inclusion for CSS it fails... What is more strange it's when we have a local CSS with an http link to a pic the pic is include in the PDF render...
:?: Any idea :?:
mikeday
Prince 5.1 only supports HTTP access for images, while documents and style sheets must still be local files. We will remove this limitation in a future release of Prince.
mikeday
There is now an alpha version of Prince that supports HTTP URLs for all resources: documents, style sheets, even fonts! :)
Stephane
I'm trying the 2006-10-31 alpha: CSS and images inclusion with relative paths does not work for me. The file path is changed into an absolute path, producing a "can't open file: Invalid argument" warning.

Specifically, the xhtml and css files are in the same folder, say D:\www (on windows XP). CSS is included through:
<link rel="stylesheet" type="text/css" href="main.css"/>

Prince tries to open the file at (taken from the output log):
file%3A\D%253A\www\main.css

and fails. Specifying the stylesheet manually works. As does specifying:
<link rel="stylesheet" type="text/css" href="D:\www\main.css"/>

I checked and everything works fine with Prince 5.1.

By the way, Prince 5.1 is clearly the best rendering engine there is, and the additions of version 6 look promising as well. Congratulations! :D
mikeday
Thanks!

There is a bug in the alpha affecting URL resolution of Windows paths. As you saw, specifying an absolute path is one way to work around the issue for the time being, and we will be releasing an updated alpha version that fixes the problem shortly.