capturing a sharper preview will take more time, that's why I set the default of 150, if you need sharper previews do this...
add this line
captureOpts.resolution = 150; // change to your taste, in the range [72.0 ... 2400.0]
between these two
captureOpts.antiAliasing = true; // anti-alias the image idoc.imageCapture (img, idoc.artboards[idoc.artboards.getActiveArtboardIndex()].artboardRect,captureOpts); // capture the active artboard
so it looks like this
captureOpts.antiAliasing = true; // anti-alias the image captureOpts.resolution = 150; // change to your taste, in the range [72.0 ... 2400.0] idoc.imageCapture (img, idoc.artboards[idoc.artboards.getActiveArtboardIndex()].artboardRect,captureOpts); // capture the active artboard