Grayscale PDF file removes all contents

When using RgbToDeviceGrayConversionStrategy to grayscale the file, it removes the content of PDF file. Also after processing the target file, it causes an error when opening in Acrobat Reader. I have attached the PDF file and a pic of the error code. This seems to be a bug.

Here is the code that I am using:

     using (var document = new Document(fileName))
            var strategy = new RgbToDeviceGrayConversionStrategy();
            foreach (var page in document.Pages)


image.png (4.9 KB)
Only10Pages.pdf (107.5 KB)


Thank you for contacting support.

We have worked with the data shared by you and have been able to reproduce the issue in our environment. A ticket with ID PDFNET-47127 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.

Thanks, here is some more info: when I tried a different pdf file I get exceptions

Message: “Parameter is not valid.”

Stack Trace:
at System.Drawing.Bitmap…ctor(Stream stream)
at Aspose.Pdf.XImage.#=zxVBUtm4Pbf4B(Stream #=zRyrFohc=, Document #=zna1U23o=)
at Aspose.Pdf.XImage.#=zxVBUtm4Pbf4B()
at Aspose.Pdf.RgbToDeviceGrayConversionStrategy.#=zDa0f8BFa_Ibf(Resources #=zWomeL1c=)
at Aspose.Pdf.RgbToDeviceGrayConversionStrategy.Convert(Page page)

Please let me know if you need the PDF file, it’s 60Mbs
It also takes about 30 seconds per page after ~30 pages, this is not good.



Thank you for getting back to us.

Please always create separate topics for separate issues, for future references because that approach is more efficient. Moreover, kindly share the PDF document here so that we may try to reproduce and investigate it in our environment.

The issues you have found earlier (filed as PDFNET-47127) have been fixed in Aspose.PDF for .NET 21.7.