Archive for February, 2007

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

Monday, February 26th, 2007

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

How to refine output page size in LitePDF?

Saturday, February 24th, 2007

To refine output page size, you could pass the page width and page height (in pixels) to NewPage() method.
To get common used page size (like A4), you could call GetPaperWidth() and GetPaperHeight() methods like follows.
litepdf.NewPage(litepdf.GetPaperWidth(”A4″), litepdf.GetPaperHeight(”A4″));
Please see our online documents for more detail.

To get uncommon used page size, you could just convert mm to inches (1 inch = 25.4mm), and then convert inches to pixels (1 inch = 72px).
210mm = (210 / 25.4 * 72)px = 595px