-1

I'm trying to convert PDF to eps using the ghost4j library however I do not get the expected result.

PDFDocument document = new PDFDocument();
document.load(new File("input.pdf"));
fos = new FileOutputStream(new File("rendition.ps"));

PSConverter converter = new PSConverter();
converter.convert(document, fos);

The final image formatting standard should be in the following parameters:

I - width of 8, 12 or 25 centimeters;

II - height not exceeding 38,5 centimeters;

III - generation in black and white and / or shades of gray (Grayscales);

IV - resolution of 200 dpi (dots per inch);

V - 8-bit EPS display with 72 dpis. (Arial Font), font size (body 7), inline (8 pt), without kerning; VI - EPS type extension (encapsulated PostScript);

how to convert PDF to PS following the above image formats using Java?

1 Answers1

2

PostScript isn't a bitmap image format. Resolution has no meaning in general for PostScript or EPS. Images contained within the PostScript or EPS can have a resolution, but this depends on any scaling of the output, especially for EPS which is often scaled.

Assuming a faithful conversion, the width and height of the EPS will depend on the width and height of the original page(s) in the PDF file. The colour of the output will likewise reflect the colour of the input.

I have no idea what you mean by "8-bit EPS display with 72 dpis" nor your insistence on a particular font and point size. Surely you want a faithful reproduction of the input ? If you mean you want a preview then that's a separate issue.

The filename extension is surely a trivial matter.

I can't give you any information on Ghost4J, however Ghostscript can produce EPS output using the eps2write device. The output will be as faithful a rendition of the input PDF as is possible for level 2 PostScript.

If you want to create a grayscale EPS from a colour input then you can use -sColorConversionStrategy.

The width and height can be fixed using -dDEVICEWIDTHPOINTS= -dDEVICEHEIGHTPOINTS= and -dFIXEDMEDIA, along with -dPDFFitPage. Note that the output is scaled identically in the x and y directions.

The eps2write device does not create a preview.

If you plan to use Ghostscript to create EPS from PDF then you need to read the documentation for Ghostscript, which is available online.

Please note (because this has the feel of commercial usage) that Ghostscript is licenced under the AGPL version 3. Ghost4J must be bound by the same licence and you should read it before deciding whether you can use Ghostscript or not.

KenS
  • 30,202
  • 3
  • 34
  • 51