PrintReportDlg.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  1. /**
  2. Licensed Materials - Property of IBM
  3. IBM Cognos Products: DOCS
  4. (C) Copyright IBM Corp. 2005
  5. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with
  6. IBM Corp.
  7. */
  8. using System;
  9. using System.Drawing;
  10. using System.Collections;
  11. using System.ComponentModel;
  12. using System.Windows.Forms;
  13. using System.Web.Services.Protocols;
  14. using SamplesCommon;
  15. using cognosdotnet_10_2;
  16. namespace PrintReport
  17. {
  18. /// <summary>
  19. /// Summary description for PrintReportDlg.
  20. /// </summary>
  21. public class PrintReportDlg : System.Windows.Forms.Form
  22. {
  23. private System.Windows.Forms.MainMenu mainMenu1;
  24. private System.Windows.Forms.MenuItem menuItemFile;
  25. private System.Windows.Forms.MenuItem menuItemExit;
  26. private System.Windows.Forms.MenuItem menuItemHelp;
  27. private System.Windows.Forms.MenuItem menuItemAbout;
  28. private System.Windows.Forms.Label ServerUrlLBL;
  29. private System.Windows.Forms.Label printOptionLBL;
  30. private System.Windows.Forms.ComboBox printOptionCB;
  31. private System.Windows.Forms.Label reportNameLBL;
  32. private System.Windows.Forms.Button RunOption;
  33. private System.Windows.Forms.ComboBox reportListCB;
  34. private System.Windows.Forms.RichTextBox resultsDisplayWindowRTB;
  35. private IContainer components;
  36. private System.Windows.Forms.TextBox reportSearchPathTB;
  37. private System.Windows.Forms.GroupBox groupBox1;
  38. private System.Windows.Forms.TextBox serverUrlTB;
  39. public static SamplesConnect cBIServer = null;
  40. public PrintReportDlg()
  41. {
  42. //
  43. // Required for Windows Form Designer support
  44. //
  45. InitializeComponent();
  46. //
  47. // TODO: Add any constructor code after InitializeComponent call
  48. //
  49. }
  50. /// <summary>
  51. /// Clean up any resources being used.
  52. /// </summary>
  53. protected override void Dispose( bool disposing )
  54. {
  55. if( disposing )
  56. {
  57. if(components != null)
  58. {
  59. components.Dispose();
  60. }
  61. }
  62. base.Dispose( disposing );
  63. }
  64. #region Windows Form Designer generated code
  65. /// <summary>
  66. /// Required method for Designer support - do not modify
  67. /// the contents of this method with the code editor.
  68. /// </summary>
  69. private void InitializeComponent()
  70. {
  71. this.components = new System.ComponentModel.Container();
  72. System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PrintReportDlg));
  73. this.mainMenu1 = new System.Windows.Forms.MainMenu(this.components);
  74. this.menuItemFile = new System.Windows.Forms.MenuItem();
  75. this.menuItemExit = new System.Windows.Forms.MenuItem();
  76. this.menuItemHelp = new System.Windows.Forms.MenuItem();
  77. this.menuItemAbout = new System.Windows.Forms.MenuItem();
  78. this.ServerUrlLBL = new System.Windows.Forms.Label();
  79. this.serverUrlTB = new System.Windows.Forms.TextBox();
  80. this.printOptionLBL = new System.Windows.Forms.Label();
  81. this.printOptionCB = new System.Windows.Forms.ComboBox();
  82. this.reportNameLBL = new System.Windows.Forms.Label();
  83. this.reportListCB = new System.Windows.Forms.ComboBox();
  84. this.RunOption = new System.Windows.Forms.Button();
  85. this.resultsDisplayWindowRTB = new System.Windows.Forms.RichTextBox();
  86. this.reportSearchPathTB = new System.Windows.Forms.TextBox();
  87. this.groupBox1 = new System.Windows.Forms.GroupBox();
  88. this.SuspendLayout();
  89. //
  90. // mainMenu1
  91. //
  92. this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
  93. this.menuItemFile,
  94. this.menuItemHelp});
  95. //
  96. // menuItemFile
  97. //
  98. this.menuItemFile.Index = 0;
  99. this.menuItemFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
  100. this.menuItemExit});
  101. this.menuItemFile.Text = "File";
  102. //
  103. // menuItemExit
  104. //
  105. this.menuItemExit.Index = 0;
  106. this.menuItemExit.Text = "Exit";
  107. this.menuItemExit.Click += new System.EventHandler(this.menuItemExit_Click);
  108. //
  109. // menuItemHelp
  110. //
  111. this.menuItemHelp.Index = 1;
  112. this.menuItemHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
  113. this.menuItemAbout});
  114. this.menuItemHelp.Text = "Help";
  115. //
  116. // menuItemAbout
  117. //
  118. this.menuItemAbout.Index = 0;
  119. this.menuItemAbout.Text = "About";
  120. this.menuItemAbout.Click += new System.EventHandler(this.menuItemAbout_Click);
  121. //
  122. // ServerUrlLBL
  123. //
  124. this.ServerUrlLBL.Location = new System.Drawing.Point(16, 16);
  125. this.ServerUrlLBL.Name = "ServerUrlLBL";
  126. this.ServerUrlLBL.Size = new System.Drawing.Size(135, 16);
  127. this.ServerUrlLBL.TabIndex = 0;
  128. this.ServerUrlLBL.Text = "Server URL";
  129. //
  130. // serverUrlTB
  131. //
  132. this.serverUrlTB.BackColor = System.Drawing.SystemColors.Control;
  133. this.serverUrlTB.Location = new System.Drawing.Point(16, 32);
  134. this.serverUrlTB.Name = "serverUrlTB";
  135. this.serverUrlTB.Size = new System.Drawing.Size(600, 20);
  136. this.serverUrlTB.TabIndex = 1;
  137. this.serverUrlTB.Text = "http://localhost:9300/p2pd/servlet/dispatch";
  138. //
  139. // printOptionLBL
  140. //
  141. this.printOptionLBL.Location = new System.Drawing.Point(16, 72);
  142. this.printOptionLBL.Name = "printOptionLBL";
  143. this.printOptionLBL.Size = new System.Drawing.Size(100, 23);
  144. this.printOptionLBL.TabIndex = 2;
  145. this.printOptionLBL.Text = "Select Print Option";
  146. //
  147. // printOptionCB
  148. //
  149. this.printOptionCB.Location = new System.Drawing.Point(16, 88);
  150. this.printOptionCB.Name = "printOptionCB";
  151. this.printOptionCB.Size = new System.Drawing.Size(248, 21);
  152. this.printOptionCB.TabIndex = 3;
  153. this.printOptionCB.SelectedIndexChanged += new System.EventHandler(this.printOptionCB_SelectedIndexChanged);
  154. //
  155. // reportNameLBL
  156. //
  157. this.reportNameLBL.Location = new System.Drawing.Point(288, 72);
  158. this.reportNameLBL.Name = "reportNameLBL";
  159. this.reportNameLBL.Size = new System.Drawing.Size(80, 16);
  160. this.reportNameLBL.TabIndex = 4;
  161. this.reportNameLBL.Text = "Report Name";
  162. //
  163. // reportListCB
  164. //
  165. this.reportListCB.Location = new System.Drawing.Point(288, 88);
  166. this.reportListCB.Name = "reportListCB";
  167. this.reportListCB.Size = new System.Drawing.Size(328, 21);
  168. this.reportListCB.TabIndex = 5;
  169. this.reportListCB.SelectedIndexChanged += new System.EventHandler(this.reportListCB_SelectedIndexChanged);
  170. //
  171. // RunOption
  172. //
  173. this.RunOption.Location = new System.Drawing.Point(520, 160);
  174. this.RunOption.Name = "RunOption";
  175. this.RunOption.Size = new System.Drawing.Size(96, 32);
  176. this.RunOption.TabIndex = 6;
  177. this.RunOption.Text = "Print Option";
  178. this.RunOption.Click += new System.EventHandler(this.RunOption_Click);
  179. //
  180. // resultsDisplayWindowRTB
  181. //
  182. this.resultsDisplayWindowRTB.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  183. | System.Windows.Forms.AnchorStyles.Left)
  184. | System.Windows.Forms.AnchorStyles.Right)));
  185. this.resultsDisplayWindowRTB.BackColor = System.Drawing.SystemColors.Control;
  186. this.resultsDisplayWindowRTB.Location = new System.Drawing.Point(24, 216);
  187. this.resultsDisplayWindowRTB.Name = "resultsDisplayWindowRTB";
  188. this.resultsDisplayWindowRTB.Size = new System.Drawing.Size(584, 176);
  189. this.resultsDisplayWindowRTB.TabIndex = 8;
  190. this.resultsDisplayWindowRTB.Text = "";
  191. //
  192. // reportSearchPathTB
  193. //
  194. this.reportSearchPathTB.BackColor = System.Drawing.SystemColors.Control;
  195. this.reportSearchPathTB.Location = new System.Drawing.Point(16, 128);
  196. this.reportSearchPathTB.Name = "reportSearchPathTB";
  197. this.reportSearchPathTB.Size = new System.Drawing.Size(600, 20);
  198. this.reportSearchPathTB.TabIndex = 9;
  199. //
  200. // groupBox1
  201. //
  202. this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  203. | System.Windows.Forms.AnchorStyles.Left)
  204. | System.Windows.Forms.AnchorStyles.Right)));
  205. this.groupBox1.Location = new System.Drawing.Point(16, 200);
  206. this.groupBox1.Name = "groupBox1";
  207. this.groupBox1.Size = new System.Drawing.Size(600, 200);
  208. this.groupBox1.TabIndex = 10;
  209. this.groupBox1.TabStop = false;
  210. this.groupBox1.Text = "Results Display Window";
  211. //
  212. // PrintReportDlg
  213. //
  214. this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
  215. this.ClientSize = new System.Drawing.Size(632, 417);
  216. this.Controls.Add(this.reportSearchPathTB);
  217. this.Controls.Add(this.serverUrlTB);
  218. this.Controls.Add(this.resultsDisplayWindowRTB);
  219. this.Controls.Add(this.RunOption);
  220. this.Controls.Add(this.reportListCB);
  221. this.Controls.Add(this.reportNameLBL);
  222. this.Controls.Add(this.printOptionCB);
  223. this.Controls.Add(this.printOptionLBL);
  224. this.Controls.Add(this.ServerUrlLBL);
  225. this.Controls.Add(this.groupBox1);
  226. this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
  227. this.Menu = this.mainMenu1;
  228. this.Name = "PrintReportDlg";
  229. this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
  230. this.Text = "Print Report Sample";
  231. this.Load += new System.EventHandler(this.PrintReportDlg_Load);
  232. this.ResumeLayout(false);
  233. this.PerformLayout();
  234. }
  235. #endregion
  236. private void menuItemExit_Click(object sender, System.EventArgs e)
  237. {
  238. this.Close();
  239. }
  240. private void menuItemAbout_Click(object sender, System.EventArgs e)
  241. {
  242. SamplesAbout about = new SamplesAbout();
  243. about.applicationName = "Print Report Sample";
  244. about.applicationVersion = "1.1";
  245. about.Show();
  246. }
  247. // This function is the entry point of this sample.
  248. private void RunOption_Click(object sender, System.EventArgs e)
  249. {
  250. string resultMessage = "";
  251. clearResultsWindow();
  252. PrintReport prObject = new PrintReport();
  253. BaseClassWrapper selectedObject = (BaseClassWrapper)reportListCB.SelectedItem;
  254. try
  255. {
  256. // 1. Get the selected Print Option {Add Printer, Delete Printer, Start Print, etc...}
  257. string selectedOption = (string)printOptionCB.SelectedItem;
  258. if ( (selectedOption == null) || (0 == selectedOption.CompareTo("")) )
  259. {
  260. MessageBox.Show("Please choose a valid print option.");
  261. return;
  262. }
  263. // 2. Get the selected report name (for the 'Start Print' command only).
  264. if (selectedObject == null)
  265. {
  266. MessageBox.Show("Please select a valid report or query name.");
  267. return;
  268. }
  269. // 3. Run
  270. runPrintOption(cBIServer, selectedOption, selectedObject.searchPath.value, ref resultMessage);
  271. displayMessage(resultMessage);
  272. }
  273. catch(SoapException ex)
  274. {
  275. displayMessage("\n...the operation failed.\nThe following information was returned:");
  276. displayMessage(SamplesException.getExceptionMessage( ex));
  277. return;
  278. }
  279. catch(System.Exception ex)
  280. {
  281. if (0 != ex.Message.CompareTo("INPUT_CANCELLED_BY_USER"))
  282. {
  283. SamplesException.ShowExceptionMessage( ex.Message, true, "Print Report Sample" );
  284. }
  285. return;
  286. }
  287. }
  288. private void PrintReportDlg_Load(object sender, System.EventArgs e)
  289. {
  290. printOptionCB.Items.Add("getAvailablePrinters");
  291. printOptionCB.Items.Add("addPrinter");
  292. printOptionCB.Items.Add("deletePrinter");
  293. printOptionCB.Items.Add("changePrinterName");
  294. printOptionCB.Items.Add("changePrinterAddress");
  295. printOptionCB.Items.Add("startPrint");
  296. reportListCB.Enabled = false;
  297. printOptionCB.SelectedIndex = 0;
  298. }
  299. private void printOptionCB_SelectedIndexChanged(object sender, System.EventArgs e)
  300. {
  301. string selectedItem = (string)printOptionCB.SelectedItem;
  302. if ( (selectedItem == null) || (0 == selectedItem.CompareTo("")) )
  303. {
  304. return;
  305. }
  306. if (0 == selectedItem.CompareTo("startPrint"))
  307. {
  308. reportListCB.Enabled = true;
  309. }
  310. else
  311. {
  312. reportListCB.Enabled = false;
  313. }
  314. }
  315. private void reportListCB_SelectedIndexChanged(object sender, System.EventArgs e)
  316. {
  317. BaseClassWrapper selectedObject = (BaseClassWrapper)reportListCB.SelectedItem;
  318. if (selectedObject == null)
  319. {
  320. return;
  321. }
  322. reportSearchPathTB.Text = selectedObject.searchPath.value;
  323. }
  324. public void setReportList(BaseClassWrapper[] reportAndQueryList)
  325. {
  326. reportListCB.Items.AddRange(reportAndQueryList);
  327. }
  328. public void setSelectedReportIndex(int value)
  329. {
  330. reportListCB.SelectedIndex = value;
  331. }
  332. public void displayMessage(string message)
  333. {
  334. resultsDisplayWindowRTB.AppendText(message + "\n");
  335. }
  336. public void clearResultsWindow()
  337. {
  338. resultsDisplayWindowRTB.Clear();
  339. }
  340. public void runPrintOption(SamplesConnect connection, string selectedPrintOption, string reportPath, ref string returnMessage)
  341. {
  342. try
  343. {
  344. string printerName = "";
  345. string newAddress = "";
  346. string printerAddress = "";
  347. string newPrinterName = "";
  348. string[] printerNameList = null;
  349. PrintReport pr = new PrintReport();
  350. SamplesInput si = new SamplesInput();
  351. baseClass[] bcPrinterList = new baseClass[1];
  352. SamplesListInput sli = new SamplesListInput();
  353. clearResultsWindow();
  354. switch(selectedPrintOption)
  355. {
  356. case "getAvailablePrinters":
  357. bcPrinterList = pr.getAvailablePrinters(connection, ref returnMessage);
  358. if ( (bcPrinterList != null) && (bcPrinterList.GetLength(0) > 0) )
  359. {
  360. displayMessage("List of available printers:");
  361. printer printerObj = new printer();
  362. printerObj.printerAddress = new stringProp();
  363. for (int i=0; i<bcPrinterList.GetLength(0); i++)
  364. {
  365. printerObj = (printer)bcPrinterList[i];
  366. displayMessage("\tPrinter Name: " + bcPrinterList[i].defaultName.value);
  367. displayMessage("\tSearch Path : " + bcPrinterList[i].searchPath.value);
  368. displayMessage("\tAddress : " + printerObj.printerAddress.value + "\n");
  369. }
  370. }
  371. break;
  372. case "addPrinter":
  373. printerName = si.getInput("Add Printer - Printer Name", "Please enter a name for the new printer.", "");
  374. printerAddress = si.getInput("Add Printer - Printer Address", "Please enter the address of the new printer", "");
  375. pr.addPrinter(connection, printerName, printerAddress, ref returnMessage);
  376. break;
  377. case "deletePrinter":
  378. bcPrinterList = pr.getAvailablePrinters(connection, ref returnMessage);
  379. if ( (bcPrinterList == null) || (bcPrinterList.GetLength(0) == 0) )
  380. {
  381. break;
  382. }
  383. printerNameList = getPrinterNames(connection, bcPrinterList);
  384. printerName = sli.getInput("Delete Printer",
  385. "Please select the name of the printer to be deleted.",
  386. printerNameList,
  387. 0);
  388. pr.deletePrinter(connection, printerName, ref returnMessage);
  389. break;
  390. case "changePrinterName":
  391. bcPrinterList = pr.getAvailablePrinters(connection, ref returnMessage);
  392. if ( (bcPrinterList == null) || (bcPrinterList.GetLength(0) == 0) )
  393. {
  394. break;
  395. }
  396. printerNameList = getPrinterNames(connection, bcPrinterList);
  397. printerName = sli.getInput("Change Printer Name",
  398. "Please select the name of the printer to be modified.",
  399. printerNameList,
  400. 0);
  401. newPrinterName = si.getInput("Change Printer Name", "Please enter the new printer name.", "");
  402. pr.changePrinterName(connection, printerName, newPrinterName, ref returnMessage);
  403. break;
  404. case "changePrinterAddress":
  405. bcPrinterList = pr.getAvailablePrinters(connection, ref returnMessage);
  406. if ( (bcPrinterList == null) || (bcPrinterList.GetLength(0) == 0) )
  407. {
  408. break;
  409. }
  410. printerNameList = getPrinterNames(connection, bcPrinterList);
  411. printerName = sli.getInput("Change Printer Address",
  412. "Please enter the name of the printer to be modified.",
  413. printerNameList,
  414. 0);
  415. newAddress = si.getInput("Change Printer Address", "Please enter the new printer address.", "");
  416. pr.changePrinterAddress(connection, printerName, newAddress, ref returnMessage);
  417. break;
  418. case "startPrint":
  419. bcPrinterList = pr.getAvailablePrinters(connection, ref returnMessage);
  420. if ( (bcPrinterList == null) || (bcPrinterList.GetLength(0) == 0) )
  421. {
  422. break;
  423. }
  424. printerNameList = getPrinterNames(connection, bcPrinterList);
  425. printerName = sli.getInput("Print",
  426. "Please select the destination printer.",
  427. printerNameList,
  428. 0);
  429. displayMessage("executing...");
  430. pr.startPrint(connection, getPrinterSearchPath(connection, printerName), reportPath, ref returnMessage);
  431. break;
  432. }
  433. }
  434. catch(SoapException ex)
  435. {
  436. SamplesException.ShowExceptionMessage( ex, true, "Print Report Sample - runPrintOption" );
  437. return;
  438. }
  439. catch(System.Exception ex)
  440. {
  441. if (0 != ex.Message.CompareTo("INPUT_CANCELLED_BY_USER"))
  442. {
  443. SamplesException.ShowExceptionMessage( ex.Message, true, "Print Report Samples - runPrintOption" );
  444. return;
  445. }
  446. }
  447. }
  448. public bool userIsAnonymous(SamplesConnect connection)
  449. {
  450. //Test for Anonymous Authentication
  451. bool bTestAnonymous = false;
  452. try
  453. {
  454. searchPathMultipleObject homeDir = new searchPathMultipleObject();
  455. homeDir.Value = "~";
  456. baseClass[] bc = connection.CBICMS.query ( homeDir, new propEnum[]{} , new sort[]{}, new queryOptions () );
  457. if ( ((bc != null) && (bc.GetLength(0) > 0)) && (0 == bc[0].searchPath.value.CompareTo("CAMID(\"::Anonymous\")")) )
  458. {
  459. bTestAnonymous = true;
  460. }
  461. }
  462. catch(Exception ex)
  463. {
  464. string output = ex.Message;
  465. return false;
  466. }
  467. return bTestAnonymous;
  468. }
  469. public string getPrinterSearchPath(SamplesConnect connection, string printerName)
  470. {
  471. string printerPath = "";
  472. string currentPrinterName = "";
  473. try
  474. {
  475. baseClass[] bcaPrinters = new baseClass[1];
  476. propEnum[] props =
  477. new propEnum[] { propEnum.searchPath, propEnum.defaultName };
  478. searchPathMultipleObject printersPath = new searchPathMultipleObject();
  479. printersPath.Value = "CAMID(\":\")/printer";
  480. bcaPrinters = connection.CBICMS.query(printersPath, props, new sort[] {}, new queryOptions());
  481. if ( (bcaPrinters == null) || (bcaPrinters.GetLength(0) == 0) )
  482. {
  483. displayMessage("There are no printers defined.");
  484. return "";
  485. }
  486. for (int i=0; i<bcaPrinters.GetLength(0); i++)
  487. {
  488. currentPrinterName = bcaPrinters[i].defaultName.value.ToLower();
  489. printerName = printerName.ToLower();
  490. if (0 == currentPrinterName.CompareTo(printerName))
  491. {
  492. printerPath = bcaPrinters[i].searchPath.value +"\n";
  493. }
  494. }
  495. }
  496. catch(SoapException ex)
  497. {
  498. SamplesException.ShowExceptionMessage( ex, true, "Print Report Sample - getAvailablePrinters" );
  499. displayMessage("getAvailablePrinters failed with error: " + ex.Message);
  500. return null;
  501. }
  502. catch(System.Exception ex)
  503. {
  504. SamplesException.ShowExceptionMessage( ex.Message, true, "Print Report Sample - getAvailablePrinters" );
  505. displayMessage("getAvailablePrinters failed with error: " + ex.Message);
  506. return null;
  507. }
  508. return printerPath;
  509. }
  510. public void setConnection(SamplesConnect connection, string cBIUrl)
  511. {
  512. cBIServer = connection;
  513. serverUrlTB.Text = cBIUrl;
  514. }
  515. public string[] getPrinterNames(SamplesConnect connection, baseClass[] bcPrinterList)
  516. {
  517. if ( (bcPrinterList == null) || (bcPrinterList.GetLength(0) == 0) )
  518. {
  519. return null;
  520. }
  521. string[] printerNameList = new string[bcPrinterList.GetLength(0)];
  522. for (int i=0; i<bcPrinterList.GetLength(0); i++)
  523. {
  524. printerNameList[i] = bcPrinterList[i].defaultName.value;
  525. }
  526. return printerNameList;
  527. }
  528. }
  529. }