Skip to content
Advertisement

Convert pdf to Postscript using Java

I recently posted a question how to convert a PDF byte[] to Postscript. According to comment, it’s not possible.

I was anyway looking into this other question on how to transform a pdf to Postscript. But still cannot get it working.

I got my PDF saved already, how would I get an already existing PDF converted to Postscript? Any way modifying this code below to achieve result?

JavaScript

Edit: I tried to modify according to comment, but it crashes when I try to load File f:

JavaScript

I get following error when trying PDDocument.load(f):

JavaScript

Advertisement

Answer

Tilman Hausherr provided correct answer to the issue that I encountered. I can produce one page PS file so far with this code. But will not produce additional pages. I in this post that you can print via Postscript commands somehow, which will not bloat the file. Will have to look into this later on. First try solve how to add additional pages. Here is the code:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement