vinc17
vinc17

Reputation: 3476

How can a .dsc file (as generated by pdf2dsc) be distinguished from a real PostScript document?

The pdf2dsc utility from Ghostscript generates a .dsc file consisting of a PostScript page list of a PDF document. How can such a file be distinguished from a real PostScript document?

The issue is that both kinds of files start with a similar header. Perhaps looking for /DSCPageCount 0 def? It seems to be present only in .dsc files and currently guaranteed to be there according to to the lib/pdf2dsc.ps file of Ghostscript.

Distinguishing such kinds of files is useful to start an adequate viewer by sniffing the contents (the "file extension" is not always available or reliable), e.g. a text viewer for a .dsc file and a PostScript viewer for a real PostScript document. In particular, the goal is to resolve this issue in the file utility.

Upvotes: 0

Views: 23

Answers (0)

Related Questions