dvi2bitmap  dvi2bitmap1.0
Dvi2Bitmap library

Overview

The dvi2bitmap library provides an object model for DVI files, and for the bitmaps which one may wish to transform them into.

For full documentation of the DVI and PK formats, see the Level-0 DVI Driver Standard, which is available on-line on CTAN, in the directory dviware/driv-standard.

For details of the classes available in the library, see the Class Hierarchy link above.

Example code

For an example of how to use the library, see the simple dvireport.cc utility in the distribution.

The outline of that program is as follows:

   DviFile* dvi;
   try {
     dvi = new DviFile(dviname);
   } catch (DviError& e) {
     cerr << "Can't open DVI file " << dviname
          << ": " << e.problem() << endl;
     exit (1);
   }
   DviFileEvent *ev;
   bool end_of_file = false;
   try {
     while (!end_of_file) {
         ev = dvi->getEvent();
         if (DviFileSetChar test = dynamic_cast<DviFileSetChar>(ev)) {
             // do stuff
         } else if (DviFileSetRule test
               = dynamic_cast<DviFileSetRule>(ev)) {
             // do more stuff
         [...]
         } else if (DviFilePostamble post
               = dynamic_cast<DviFilePostamble>(ev)) {
        end_of_file = true;
         }
         ev->release();
     }
   } catch (DviError& e) {
     cerr << "Error processing DVI file" << endl;
   }
   delete dvi;