about

download

reference

tutorials

support

gallery






-

@basil_js
»

Exporting to PDF

How to create hundreds of variation of a single InDesign project. By Ludwig Zeller

#includepath "~/Documents/;%USERPROFILE%Documents";
#include "basiljs/bundle/basil.js";

function draw() {
  
  b.textSize(64);
  var tf = b.text("this content will be overwritten", b.width/2-250,b.height/2-150, 500, 300);
  
  for( var i = 0; i < 20; i++) {
    tf.contents = "hello pdf " + i;
    b.savePDF("hello-pdf-" + i + ".pdf");
  }
  
  // show export options
  //b.savePDF("hello.pdf",true);
};

b.go();
  • The InDesign document needs to be saved first so that basil.js knows where to put the exported PDF.
  • The second parameter can turn on the export settings dialog for quality, etc
  • If the second parameter is not given savePDF will use the previous export settings.