draw-document.js 307 B

123456789
  1. // Draw all pages in a document and save them as PNG files.
  2. var doc = Document.openDocument(scriptArgs[0]);
  3. var n = doc.countPages();
  4. for (var i = 0; i < n; ++i) {
  5. var page = doc.loadPage(i);
  6. var pixmap = page.toPixmap(Matrix.identity, ColorSpace.DeviceRGB);
  7. pixmap.saveAsPNG("out" + (i+1) + ".png");
  8. }