Forum Bugs

PrinceEvents (java API) not functioning (Prince 5.1)

I'm using Prince 5.1 on Linux. Here's the version info:
prince --version
YesLogic Prince 5.1 rev 14
Copyright 2002-2007 YesLogic Pty. Ltd.
Demo License

I find that the following code does not provide the class implementing the PrinceEvents interface with anything. Here's my reference code:

    public static void main (String[] args) {
        try {
            Prince p = new Prince("/tmp/prince-5.1/bin/prince", new PrinceEventHandler());
            FileInputStream fis = new FileInputStream("bad.html");
            FileOutputStream fos = new FileOutputStream("bad.pdf");
            p.convert(fis, fos);
        } catch (Exception e) {

The class implementing PrinceEvents is PrinceEventHandler, like so:
class PrinceEventHandler implements PrinceEvents {
    public PrinceEventHandler() {
        System.out.println("PrinceEventHandler initialized");

    public  void onMessage(String msgType, String msgLoc, String msgText) {
        System.out.println("princeOutput: ["+msgType+"] for: "+msgLoc);

The execution of the code follows with the sole output to the console as
PrinceEventHandler initialized

Note that the PrinceEventHandler did not get invoked with any messages.

The princelog file registered with the Prince object via the setLog call contains the errors found:
Tue Apr 3 15:34:54 2007: ---- begin
Tue Apr 3 15:34:54 2007: -:8: error: Opening and ending tag mismatch: br line 5 and html
Tue Apr 3 15:34:54 2007: -:8: error: Premature end of data in tag body line 3
Tue Apr 3 15:34:54 2007: -:8: error: Premature end of data in tag html line 1
Tue Apr 3 15:34:54 2007: -: error: could not load input file
Tue Apr 3 15:34:54 2007: finished: failure
Tue Apr 3 15:34:54 2007: ---- end

The HTML (bad.html) is intentionally invalid. This is what is looks like:
<head><title>This is a title</title></head>
This is some text. <a>this is text</a>
That was a bad BR tag.
We aren't closing the body tag either.

The PDF generated (bad.pdf) is zero bytes in size.
This is caused by a limitation of the Prince Java interface when calling the convert() method that takes an InputStream and an OutputStream, as described in the documentation:
Note that no error/warning messages will be returned via the PrinceEvents interface when calling this method. This is due to a limitation of Prince that will be fixed in a future release. In the meantime, we recommend the use of the setLog() method to specify a log file that can be used to view error/warning messages from Prince.

The other convert() methods that take filenames do not have this issue.
I am having the exact same issue (using the in and out streams and not getting any messages passed to the PrinceEvents object.) with prince 7.1 on windows... Are we still waiting for a future release when this will be fixed? (I was really hoping that I could get useful feedback without having to create a bunch of files on my server's file system.)

Prince --version
Prince 7.1
Copyright 2002-2010 YesLogic Pty. Ltd.
Non-commercial License
I'll bump this issue up the roadmap.
This issue has been addressed in the latest Prince alpha version; now error/warning messages will be returned via the PrinceEvents interface for all convert methods.