0

I am using XPSDocumentWriter to create a XPS document in c# , What are the options I have if I have to write the XPSDocument in Grayscale , i.e in black and white.

TheGeekYouNeed
  • 7,509
  • 2
  • 26
  • 43
user679530
  • 897
  • 1
  • 8
  • 11

1 Answers1

1

You need to use a method of XPSDocumentWriter which takes a PrintTicket which in turn must be setup with OutputColor = OutputColor.Grayscale;

For details and sample code see http://msdn.microsoft.com/en-us/library/system.printing.printticket.outputcolor.aspx

Yahia
  • 69,653
  • 9
  • 115
  • 144
  • I tried this but still my XPS Document created has colors in it. I used the print tickst outputcolor as grayscale – user679530 Oct 18 '11 at 20:59
  • PrintTicket printTicket=new PrintTicket(); printTicket.OutputColor = OutputColor.GrayScale; XpsDocumentWriter writer = XpsDocument.CreateXpsDocumentWriter(xpsDoc); writer.Write(surface,printTicket); xpsDoc.Close(); – user679530 Oct 18 '11 at 22:10
  • that's not enough code... what is `surface` ? how is `xpsDoc` created ? – Yahia Oct 18 '11 at 22:15
  • surface is the framework element and xps doc is creadted by the following – user679530 Oct 18 '11 at 22:17
  • var xpsDoc = new XpsDocument(path, FileAccess.Write, CompressionOption.Maximum) – user679530 Oct 18 '11 at 22:18
  • then the problem is that Grid and how it interacts with the `PrintTicket`... since I never use Xps the way you seem to I can't help you any further... maybe someone else can... – Yahia Oct 18 '11 at 22:23