Do you know why it is not valid?
My suggestion was to pass it to Ghostscript / Ghostvoiew, but given that Ghostview can view it, it would seem that at least some interpreters consider this to be Postscript.
Thus, it can be something specific for your printer - either it is picky about something in PS that allows Ghostscript, or access to something that does not exist on your printer (possibly in the file system) or exceeds some memory limit, or ...
The fact is that this may not be an erroneous PS program, and therefore the library / API for checking it may not help
Edit: print any of these? You tried the printer from another manufacturer (or the Postscript interpreter provider, one way or another). Does Ghostview provide / log any warnings or errors?
Where (which application) comes from the document?
Can you create other instances of the document? (e.g. really plain / empty to see if this also leads to errors)
If there is no API that provides access to a specific interpreter that is used in your printer, I think that you test it on another PS interpreter (Ghostscript).
Since there are not many PS clones in the world, gaining access to a base other than GS will probably not be easy.
Edit2: this link (if the information is pretty old) contains information on how to get additional information from your printer about the error: http://www.quite.com/ps/errors.htm
The archetypal paul
source share