code: public static void main(String[] args)
      {
          if (args.length != 3)
          {
              System.err.println("Usage: ImageRenderer <url> <output_file> <format>");
              System.err.println();
              System.err.println("Renders a document at the specified URL and stores the document image");
              System.err.println("to the specified file.");
              System.err.println("Supported formats:");
              System.err.println("png: a Portable Network Graphics file (bitmap image)");
              System.err.println("svg: a SVG file (vector image)");
              System.exit(0);
          }
          
          try {
              Type type = null;
              if (args[2].equalsIgnoreCase("png"))
                  type = Type.PNG;
              else if (args[2].equalsIgnoreCase("svg"))
                  type = Type.SVG;
              else
              {
                  System.err.println("Error: unknown format");
                  System.exit(0);
              }
              
              FileOutputStream os = new FileOutputStream(args[1]);
              
              ImageRenderer r = new ImageRenderer();
              r.renderURL(args[0], os, type);
              
              os.close();
              System.err.println("Done.");
          } catch (Exception e) {
              System.err.println("Error: " + e.getMessage());
          }
          
      }
docs: =================================================================================