code: public void drawToImageWithAreas(String path, String areaNames)
      {
          try
          {
              ImageOutputDisplay disp = new ImageOutputDisplay(getPage().getWidth(), getPage().getHeight());
              disp.drawPage(getPage());
              showAreas(disp, getAreaTree().getRoot(), areaNames);
              disp.saveTo(path);
          } catch (IOException e) {
              log.error("Couldn't write to " + path + ": " + e.getMessage());
          }
      }
docs: Draws the page to an image file and marks selected areas in the image.
  @param path The path to the destination image file.
  @param areaNames A substring of the names of areas that should be marked in the image. When set to {@code null}, all the areas are marked.