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>