Hello,
I’m trying to convert EPS image to PDF, and then convert it to grayscale. The code I’m using for that is here:
FileInputStream fileInputStream = new FileInputStream("example.eps");
PsDocument epsImage = new PsDocument(fileInputStream);
ByteArrayOutputStream epsOutputStream = new ByteArrayOutputStream();
epsImage.save(new PdfDevice(epsOutputStream), new PdfSaveOptions());
Document document = new Document(epsOutputStream.toByteArray());
RgbToDeviceGrayConversionStrategy strategy = new RgbToDeviceGrayConversionStrategy();
for (Page page : document.getPages()) {
strategy.convert(page);
}
document.save("example.pdf");
However, as a result with this example file:
example.eps.zip (516.7 KB)
After the conversion, it’s only partially converted to grayscale:
example.pdf (2.4 MB)
I’m wondering, what could be the reason for that, and also, maybe there is another way to convert EPS to grayscale? I’m using it later as PDFPageStamp.