summaryrefslogtreecommitdiff
path: root/docs/examples/draw-document.js
diff options
context:
space:
mode:
Diffstat (limited to 'docs/examples/draw-document.js')
-rw-r--r--docs/examples/draw-document.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/examples/draw-document.js b/docs/examples/draw-document.js
new file mode 100644
index 00000000..1e285ede
--- /dev/null
+++ b/docs/examples/draw-document.js
@@ -0,0 +1,9 @@
+// Draw all pages in a document and save them as PNG files.
+
+var doc = new Document(argv[1]);
+var n = doc.countPages();
+for (var i = 0; i < n; ++i) {
+ var page = doc.loadPage(i);
+ var pixmap = page.toPixmap(Identity, DeviceRGB);
+ pixmap.saveAsPNG("out" + (i+1) + ".png");
+}