Convert Colored PDF to Black and White using Aspose.PDF for .NET - MakeGrayscale method

To my knowledge, MakeGrayScale property is to convert a page to gray scale. I have used the following code:
static string destinationpath = Application.StartupPath + @"\AsposeUtility";
Aspose.Pdf.Document doc = new Aspose.Pdf.Document(sourceMsgPath);
foreach (Page page in doc.Pages)
{
page.MakeGrayscale();
}
doc.Save(destinationpath + “ParsedPdf.pdf”);

Is this the right way to save the same pdf doc after making changes to the pages of the pdf ? Also , can you please let me know,if there’s a way to export the existing color pdf to black and white pdf ?

@alishasharma

The Page.MakeGrayscale() method is used to convert images on page as grayscaled. However, please try using following code snippet in order to convert whole PDF as grayscaled:

Document document = new Document("input.pdf");
RgbToDeviceGrayConversionStrategy strategy = new RgbToDeviceGrayConversionStrategy();
for (int idxPage = 1; idxPage <= document.Pages.Count; idxPage++)
{
Aspose.Pdf.Page page = document.Pages[idxPage];
strategy.Convert(page);
}
document.Save("output.pdf");

We regret to share that this feature is not available at the moment. However, we have logged a feature request as PDFNET-35728 in our issue tracking system for its implementation. We will surely investigate the feasibility of this feature and keep you posted with the status of its availability. Please be patient and spare us some time.

We are sorry for the inconvenience.