Printing color PDF in black and white

I am trying to print a color PDF in black and white.

Setting the System.Drawing.Printing.PageSettings.Color property to false does not work.

Can you please advise me how to print a color PDF in black and white.

Here is the code I am using:

System.Drawing.Printing.PrinterSettings ps = new System.Drawing.Printing.PrinterSettings();<?xml:namespace prefix = "o" ns = "urn:schemas-microsoft-com:office:office" />

System.Drawing.Printing.PageSettings
pgs = new System.Drawing.Printing.PageSettings();
<o:p></o:p>

ps.PrinterName = printerName;<o:p></o:p>

ps.Copies = copies; <o:p></o:p>

pgs.PaperSize = new
System.Drawing.Printing.PaperSize(“A4”, 827, 1169); <o:p></o:p>

pgs.Margins = new
System.Drawing.Printing.Margins(0, 0, 0, 0);<o:p></o:p>

pgs.Landscape = false;<o:p></o:p>

<o:p></o:p>

pgs.Color = false;<o:p></o:p>

<o:p> </o:p>

Aspose.Pdf.License
license = new Aspose.Pdf.License();<o:p></o:p>

license.SetLicense(“Turners.Crm.Core.Aspose.Pdf.lic”);<o:p></o:p>

license.Embedded = true;<o:p></o:p>

<o:p> </o:p>

using (PdfViewer viewer = new PdfViewer())<o:p></o:p>

{
<o:p></o:p>

viewer.PrintPageDialog = false; <o:p></o:p>

using (Stream s = new MemoryStream(pdfInvoice))<o:p></o:p>

{<o:p></o:p>

viewer.BindPdf(s);
<o:p></o:p>

viewer.PrintDocumentWithSettings(pgs,
pg); <o:p></o:p>

} <o:p></o:p>

}<o:p></o:p>

Hi there,


Thanks for your inquiry. Please amend your code as following, set PrintAsImage property to true to get black and white print. Hopefully it will serve the purpose.

viewer.BindPdf(s); <o:p></o:p>

viewer.PrintAsImage = true;

viewer.PrintDocumentWithSettings(pgs, ps);



Please feel free to contact us for any further assistance.


Best Regards,

Hi Chris,


Thanks for using our products.

Adding more to Tilal’s comments, when using viewer.PrintAsImage = true; property and when trying to print the documents to XPS document writer, not all PDF files are printed as Black & White. Furthermore, please note that this property indicates that all the contents (image, text, form fields etc) are printed as image in resultant output.

In order to fulfill your requirement to print the output as Black and White, I have logged this requirement in our issue tracking system
under New Features list as PDFNEWNET-35728. We will further investigate
this requirement in details and will keep you updated on the status of a
correction.

We apologize for your inconvenience.