Forum How do I...?

Java wrapper and URLs

mrossi
Hello,

I'm trying to use the Java wrapper to Prince.

Since we don't want to pollute the filesystem, I'm using the convert(InputStream, OutputStream) method of class Prince together with setBaseURL(String) method. This makes me guess that Prince is able to load resources like images referenced in the HTML by using HTTP requests. But then, why not load the HTML itself with a HTTP request, something like

p = new Prince(exePath);
p.setBaseURL(baseURL);
ok = p.convert(htmlURL, outputStream);

Said another way, I don't understand the unsymmetrical treatment of the HTML and its related resources like CSSs, images, etc. The HTML needs to be specified either as a path on the filesystem or as InputStream while the resources can be left specified as URLs inside the HTML.

Am I missing some important point?
mikeday
Actually you can specify a URL string as the input document to the convert() method. However, you also have to specify a filename for the PDF output. The Java wrapper doesn't currently have a convert method that takes a filename/URL for the input and an OutputStream for the PDF output, but we could add one.
mrossi
I see.

I think for the moment I can leave with the current API.
mikeday
Today we have released an updated version of the Prince Java wrapper that includes a new convert method that takes a filename for the XML/HTML input and an OutputStream for the PDF output.