Search code examples
xmlgraphicsapache-fop

How can you tell what version of CGM a file is?


I have been searching and while I can find many descriptions of the different versions of CGM files, I am trying to find a way to tell what version of CGM a particular file is.

I have been having some issues with printing pdf documents that include CGM images. Most will print, some will not. I have been told we only support CGM version 1, so I am looking for a way to tell what CGM version these images that aren't printing are.

We use Apache FOP and the jcgm plugin to turn an xml file, xsl file and some graphics into a pdf file.

Is there any way to tell what version a cgm file is so I can determine if that is the problem I am running into or if it is something else?


Solution

  • The version of a CGM file is encoded in its header: the METAFILE VERSION command contains the version number (1, 2, 3, 4).

    The jcgm library provides access to all commands of a CGM file: the CGM class has a showCGMCommands method that can be used to print them.

    For the images that don't print, you can check whether the commands they're using is supported by the library since jcgm does not support all commands: jcgm implemented commands.