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
code)?