Forum How do I...?

Resolving URL's in Java Interface

Hello, I've been testing out Prince for the past few days, and am extremely impressed by its HTML to PDF capabilities. I need to feed Prince an InputStream from a URL, but the conversion abilities of Prince drop drastically when I do this. Prince fails to resolve any relative links to images and CSS stylings when I use the convert(InputStream, OutputStream) as opposed to the convert(String, String) methods.

Are there any workarounds to get Prince to resolve relative paths it comes across in a webpage similiar to how it resolves them when dealing with local files? Thanks.
This is a limitation of the convert method that takes an InputStream.

In the future we will have two solutions for this issue, firstly by adding a method to specify the base URL of the document to be processed, secondly by supporting HTTP access natively within Prince.
Today we have released Prince 5.1 rev 8, which supports a new --baseurl command-line option for specifying the base URL of the input document. Please give it a try and see if it does what you need. We will release updated versions of the Java and COM interfaces for Prince with a setBaseURL() method later this week.
The updated Java and ActiveX/COM interfaces that support setBaseURL() are now available for download.