How do I convert a PDF to grayscale?

Q: We have a requirement to convert inbound PDFs to grayscale, I have
seen snippetts about color spaces but these seem to apply to
individual elements. Is there an easy way to replace all color spaces
within a document with gray scales?

Or do I have to enumerate all elements (if so, do you have some sample
A: The simplest option would be to render PDF pages in grayscale mode
(e.g. using pdftron.PDF.PDFDraw and "ColorSpace"/"Gray" rendering
hint). Rendered images could be added to an output (raster) PDF

In case you need to preserve vector art, text,etc you could also use
PDFNet to change color spaces and colorants associated with text,
graphics, and images. As a starting point you may want to take a peek
at ElementEdit sample: