const saveto = "/Users/*****/Desktop/******/";//保存先
var doc = app.activeDocument;
var p = doc.pages;
var L = p.length;
while (L--) {
    var pNO = doc.pages[L].name
    var pdfName =  ("0000" + pNO).slice(-4);//4桁のノンブル(桁数足りない場合先頭は0)
    var pdfname = saveto + pdfName + ".pdf";
    app.pdfExportPreferences.pageRange = pNO;
    //ジョブオプション名指定
    doc.exportFile(ExportFormat.pdfType, new File(pdfname), false, "SMART_PDF_X1A");
}
//doc.close(SaveOptions.no);