@Override
 public void callback(DocumentClosure incomingClosure) {
   if (outputOneAtATime) incomingClosure.serialize(outputStream);
   else if (++currentResult >= documentCollection.size()) {
     System.out.println("\n\n");
     try {
       generateHtml();
     } catch (IllegalArgumentException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     } catch (IllegalAccessException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     } catch (IOException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     } catch (SIMPLTranslationException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     } catch (URISyntaxException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
     semanticsSessionScope.getDownloadMonitors().stop(false);
   }
 }
  public void generateHtml()
      throws IllegalArgumentException, IllegalAccessException, IOException,
          SIMPLTranslationException, URISyntaxException {
    appendHeader(print);
    Desktop desktop = Desktop.getDesktop();
    URI uri = new URI("MmtoHtml.html");
    for (DocumentClosure documentClosure : documentCollection) {
      Document document = documentClosure.getDocument();

      TranslationContext translationContext = new TranslationContext();
      document.serializeToHtml(print, translationContext);
    }
    appendFooter(print);
    print.close();
    desktop.browse(uri);
  }