How to convert vsd files to pdf documents in batch processing?

Polestar Virtual Printer is able to convert vsd files to pdf documents in batch processing. The following JScript codes enumerate all vsd files in the specified directory then open and print them one by one to Polestar Virtual Printer.
var fso = new ActiveXObject(”Scripting.FileSystemObject”);//for enumerating vsd files
var f = fso.GetFolder(”c:\\test”);
var fc = new Enumerator(f.files);

var visio = new ActiveXObject(”Visio.Application”);//visio application
visio.Visible = false;
var docs = visio.Documents;

for (; !fc.atEnd(); fc.moveNext())
{
    var fn = fc.item() + “”;     //file name
     if(fn.substr(fn.length-4, 4).toLowerCase() != “.vsd”)     //handles only vsd file
     continue;

    var doc = docs.Open(fn);  //open the vsd document
   doc.PrintOut(0,                  //print all
                           0,                  //from
                           0,                  //to
                          false,           //ScaleCurrentViewToPaper
                        ”Polestar Virtual Printer”,   //printer name
                          false);

     doc.Close();                   //close the document
     WScript.Sleep(3000);
}

visio.Quit();                   //shut down visio

Leave a Reply

You must be logged in to post a comment.