Export image grayscale to memory

Product: PDFTron

Product Version: PDFTron Java - v9.1.0

Please give a brief summary of your issue:
Is there a way to export an image from a pdf in grayscale to memory?

Please describe your issue and provide steps to reproduce it:
I would like to export a png image from a pdf page in grayscale without saving it to the filesystem. I have seen the PDFDraw.export method that accepts the gray hint as a parameter in the samples, but it also expects the file path to store the result, is there a way to get the result as a byte array or input stream?

Please provide a link to a minimal sample where the issue is reproducible:

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:


Currently no. You can use PDFDraw.GetBitmap to get a BufferedImage and then you could convert to greyscale using that Java class. Example below.