Forum News

Revision 2 of the Prince Java interface released

Cong
We have released revision 2 of the Prince Java interface today. It can be downloaded here.
The new revision has included a mechanism for Prince messages to be conveyed to the user during conversion. A Java interface named PrinceEvents has been added to the package com.princexml for this purpose. Users wishing to process the messages should create a Java class that implements the interface and provide a definition of the onMessage method, for example:

import java.io.*;
import com.princexml.PrinceEvents;

public class PrinceMessages implements PrinceEvents 
{
    	public void onMessage(String msgType, String msgLocation, String msg){
	        
    	// code to process the message here

    	//...
    	//...

    	}
}


An object of the class PrinceMessages should be created and passed into the Prince constructor when instantiating the Prince object, for example:

PrinceMessages pMsg = new PrinceMessages();
Prince prObj = new Prince("C:\\prince\\engine\\bin\\prince.exe", pMsg)


Prince class methods can then be invoked to apply style sheets, set encryption information and perform the conversion. Any messages generated during the conversion will be processed by the onMessage method.

Please read the README.txt file for more details.