AJMansfield
AJMansfield

Reputation: 4129

Display PostScript from within Java

Is there some sort of Display PostScript element that can be added to a GUI in Java? I am much more fluent in PostScript than in Java, and I need to do some more complicated shapes and hit detection, which would be far easier using a Display PostScript system.

Is there such a library in existence? If there is, what is it/where can I go to find it?

I have searched on google for it, but I can't find anything that really could do what I want, because of the large number of only partially-relevant results my searches have turned up.

Upvotes: 1

Views: 2895

Answers (2)

zippy1978
zippy1978

Reputation: 642

Of course you can do it with Ghost4J :

// load PDF document
PDFDocument document = new PDFDocument();
document.load(new File("input.pdf"));

// create renderer
SimpleRenderer renderer = new SimpleRenderer();

// set resolution (in DPI)
renderer.setResolution(300);

// render
List<Image> images = renderer.render(document);

If you want to render Postscript instead of PDF : used PSDocument class instead. The full example is available here.

Upvotes: 3

Dimitar Ivanov
Dimitar Ivanov

Reputation: 116

You can use Ghost4J. It provides features like converting .ps to .pdf and rendering .pdf-s using ImageIO, which can be applied as a solution to your problem.

Upvotes: 2

Related Questions