CERN -- European Laboratory for Particle Physics

HP-GL Viewer

Linux Installation at CERN


[CAD Support] [HP-GL Viewer] [CERN Installation Guide]

1. Installing the HP-GL Viewer

For machines running a recent CERN Linux distribution, e.g., Scientific Linux CERN 4 (SLC4), Scientific Linux CERN 5 (SLC5), Scientific Linux CERN 6 (SLC6), or CERN CentOS 7 (CC7), we recommend to install the HP-GL viewer from central distribution using the Software Updater. Users running other Unix machines and users having special constraints may perform a manual installation of the HP-GL viewer.

Making a Manual Installation

Go to the downloads page and get the version you need. For Tar-based packages, unpack the file into a directory and follow the included readme-file. For RPM-packages, install via command:

rpm -U package-file-name

2. Configuring Mozilla Firefox 3

Configuring Web-browsers on Unix and Linux to properly manage file associations and user-provided MIME-types is no easy task. Unix / Linux have no coherent standard on how to manage these kinds of things, so it is up to the desktop manager and the application, in this case the Web-browser. The configuration methods are different for every browser, so here is presented one of the most common ones as an example.

Configuration of file and mime types for the HP-GL viewer on Firefox 3 (and probably later) on Linux

  1. Quit Firefox if already running.

  2. Go to directory:

    $HOME/.mozilla/firefox/some_weird_string.default

    The string "some_weird_string.default" refers to some unpronounceable directory name auto-generated by Firefox.

  3. Make a backup copy of file mimeTypes.rdf:

    cp -p mimeTypes.rdf mimeTypes.rdf.orig

  4. Open the file mimeTypes.rdf in an editor:

    1. Search for string "hpgl".

    2. If there were no lines with this string, continue to step 7.

    3. If instances of this string were found, you have two options: Either recreate a clean mimeTypes.rdf (go to step 5) or try to edit the existing one (go to step 6). If you have other existing MIME-type settings that you don't want to lose, you can try the second option, otherwise the first option is probably safer.

  5. To create a fresh mimeTypes.rdf:

    1. Delete the existing mimeTypes.rdf:

      rm mimeTypes.rdf

    2. Start Firefox.

    3. Go to menu: Edit - Preferences - Applications. You'll see some default settings there.

    4. Without doing anything else, close the preferences window and quit Firefox.

    5. You'll see that file mimeTypes.rdf has been regenerated. Continue to step 7.

  6. To keep the existing mimeTypes.rdf:

    1. Search for string "hpgl".

    2. Every instance, where this string occurs should be deleted. Since the file format is XML, you will have to delete the complete associated tagged entities instead of just the single line, where the string occurs. This requires some understanding of the structure of the file and XML in general. See the the XML-code in step 8d for an example. This edition process is obviously error-prone and may render your file invalid (that's why you made a backup copy in step 3).

    3. Save the file and continue to step 7.

  7. Find out where the HP-GL viewer binary is installed. If it's in the search path, you can just run command:

    which hpglview

    This should give you the explicit path to the viewer application. If the viewer is not in the path, you'll need to find it otherwise. If you downloaded and installed the viewer yourself, it will obviously be wherever you put it. The standard installation at CERN uses path "/usr/bin/hpglview".

  8. Edit the file mimeTypes.rdf:

    1. In the file, find the line:

      <RDF:Seq RDF:about="urn:mimetypes:root">

    2. Immediately AFTER that line, paste line:

      <RDF:li RDF:resource="urn:mimetype:image/hpgl"/>

    3. Find the line at the end of the file:

      </RDF:RDF>

    4. Immediately BEFORE that line paste the following lines:

      <RDF:Description RDF:about="urn:mimetype:externalApplication:image/hpgl"
         NC:path="/usr/bin/hpglview"
         NC:prettyName="hpglview"/>
      <RDF:Description RDF:about="urn:mimetype:image/hpgl"
         NC:description="HP-GL drawing"
         NC:value="image/hpgl"
         NC:editable="true">
        <NC:fileExtensions>plt</NC:fileExtensions>
        <NC:fileExtensions>hpgl</NC:fileExtensions>
        <NC:fileExtensions>hpg</NC:fileExtensions>
        <NC:fileExtensions>hpgl2</NC:fileExtensions>
        <NC:handlerProp RDF:resource="urn:mimetype:handler:image/hpgl"/>
      </RDF:Description>
      <RDF:Description RDF:about="urn:mimetype:handler:image/hpgl"
         NC:alwaysAsk="false"
         NC:saveToDisk="false"
         NC:useSystemDefault="false"
         NC:handleInternal="false">
        <NC:externalApplication RDF:resource="urn:mimetype:externalApplication:image/hpgl"/>
      </RDF:Description>

      Note that in the above, on the second line (starting with string "NC:path="), replace the string "/usr/bin/hpglview" with wherever you found the viewer to be located in step 7. Note also that the path must be explicit, i.e., Firefox performs no implicit path search to locate it.

    5. Save the modified file.

Now the MIME-type image/hpgl should be associated with the HP-GL viewer in Firefox as well as all files ending in .plt, .hpgl, .hpg, and .hpgl2. If you want to associate more file suffixes with the viewer, adding fileExtensions properties to the code above should be self-explanatory. Note that these settings work well when the incoming HTTP-stream has the correct image/hpgl MIME-type set in the content-type header field. The explicit file suffix associations exist for opening HP-GL files directly from the file system view of Firefox, and should work ok for that. However, if the incoming HTTP-stream has no correctly recognized MIME-type, and even if the target file had the correct suffix, according to the HTTP specification Firefox is at liberty to ignore these settings altogether and try to interpret the file however it chooses. At times, it may then decide to interpret the file as text (opened directly in Firefox), or as generic binary (ask to be saved on disk), no way to know for sure.

If you have any problems, please contact EDMS Support

[CAD Support] [HP-GL Viewer] [CERN Installation Guide]
CERN -- HP-GL Support, modified 2024-05-07