Change color .pdf to Grayscale using Aspose.PDF for .NET

Hi,

Is there any way to open a color .pdf, change it to grayscale and save it. Please note that I want to do it for soft copy and this requirement is nowhere related to Printing.

Thanks

@agarwalyogi

You can use a virtual printer which will save the printed document into PDF e.g. Microsoft Print to PDF. You can then print PDF documents as grayscale using Aspose.PDF for .NET. Please use new property PdfViewer.PrintAsGrayscale:

Print PDF document as Grayscale

using (PdfViewer viewer = new PdfViewer())
{
string outputFile = @"c:\41686.out.xps";

viewer.OpenPdfFile(inputFile);
viewer.PrintPageDialog = false;
viewer.PrintAsGrayscale = true;

PrinterSettings ps = new PrinterSettings();
PageSettings pgs = new PageSettings();

ps.PrinterName = "Microsoft Print to PDF"; // this is virtual printer
ps.PrintFileName = outputFile;
ps.PrintToFile = true;
pgs.PaperSize = new PaperSize("A4", 827, 1169);
ps.DefaultPageSettings.PaperSize = pgs.PaperSize;
viewer.PrintDocumentWithSettings(pgs, ps);
}