Forum How do I...?

http requests

Anonymous
Hi,
is it possible with prince to access the xhtml source, all css files and inline images referenced in the xhtml source over http - connection? (as html2ps does)
Example: prince http://myserver/report.html report.pdf
We have image url's in our html reports which make CGI requests.

If not, wouldn't this be a nice feature??

Stephan
mikeday
Hi Stephan,

HTTP support would be a great feature to add to Prince! :)

In the meantime, it is always possible to use a download tool such as w get to recursively download the document and all linked resources (including images and style sheets) and save them in a local directory for Prince to access. In fact, w get can even rewrite the URLs in the HTML document to point to the new local files, although sadly it cannot rewrite URLs in style sheets.

(For some reason if I write "w get" as one word without the space the forum gives me an internal error; I have no idea why that happens).

Cheers,

Michael
Anonymous
mikeday wrote:
HTTP support would be a great feature to add to Prince! :)


Any plans to do this?
Unfortunately, w_get does not get our image because the URL (with many CGI-parameters) is too long!

Stephan
mikeday
Ouch, that is a tricky problem, as many tools (even web browsers) have strict limits on the maximum length of URLs.

The ideal solution would be to reduce the length of the image URLs, either by removing unnecessary query parameters or hashing the queries to a simple numeric ID that the server can identify. That would make it easier for you to use arbitrary off the shelf tools. Also, even if we add HTTP support to Prince, it is possible that we might still not be able to process the URL if it is too long, depending on which HTTP library we end up using.
mikeday
Prince 5.1 rev 3 supports loading images from HTTP URLs; please give it a try and let us know if the URL length causes any problems.
Anonymous
Hi Mike,
sorry for the late reaction..

Image loading via HTTP request works fine (also with our long URLs). Thanks the feature.

What about HTTP support for the input document and its css references?

In the meantime we continue to use 'w_get --page-requisites' to download all necessary files and start prince after that.

The problem with w_get was, that it saves the downloaded image under a filename that is equal to the URL. So limitation regarding the maximum filename length of the operating system makes the problem!
We made a w_get patch to save the downloaded image under a shorter filename, made of the hash value of the (long) filename.

We can live with this, but would welcome 'full' HTTP support of prince very much.

Stephan
dynnamitt
mikeday wrote:
Prince 5.1 rev 3 supports loading images from HTTP URLs; please give it a try and let us know if the URL length causes any problems.


I have tested this w/Prince 5.1 rev 4 and it seems that IF ONLY the images is small enough.. it will work.

Using image content straight from flickr.com (and several pics on one page) will only work if I use thumbnail versions:
http://static.flickr.com/44/135155868_fd3a5c404e_t.jpg
NOT w/full content versions:
http://static.flickr.com/44/135155868_fd3a5c404e_o.jpg

..and Error log wil not report anything

What is the kb limit here?

please help
kjetil.[/url]