Created
December 18, 2016 22:49
-
-
Save hallvors/1d216f00225e35f3c1271e9df9a00e2e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
public class MakePDF { | |
/* | |
* Instantiates a Prince object | |
*/ | |
public static class MessageListener implements com.princexml.PrinceEvents{ | |
public void onMessage(String msgType, | |
String msgLocation, | |
String msgText) { | |
System.out.println(msgText); | |
} | |
} | |
public static void main(String []args) { | |
System.out.println("Hello Prince"); // prints Hello World | |
com.princexml.Prince p = new com.princexml.Prince("../../builds/prince-11-win64/bin/prince.exe", new MessageListener()); | |
p.addScript("../../tmp/log-page-count.js"); | |
/* If you use Log.info() in the JS, you need this line enabled: */ | |
// p.setVerbose(true); | |
try{ | |
p.convert("../../tmp/blank.htm", "../../tmp/blank.pdf"); | |
}catch(IOException e){ | |
System.out.println("Exception!"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment