I am currently in the process of writing an application in Java that creates PostScript documents and I am looking for a way to create a sample image of the document. The sample image is just to be used for the user to see how the document they are building looks in its current state.
Does anybody know of a way to do this? If anybody knows of an algorithm to do so that would be great. I'm also open to third party software if I have to (last resort).
You can do it with Ghost4J like this :
// load PS document
PSDocument document = new PSDocument();
document.load(new File("input.ps"));
// create renderer
SimpleRenderer renderer = new SimpleRenderer();
// set resolution (in DPI)
renderer.setResolution(300);
// render
List<Image> images = renderer.render(document);
It works as well with PDF files. Checkout a full example here.