i found code printing. want sent printer automaticaly without dialog box. know printername. printer name sql table. how can ?
// select printer , printer settings printdialog pd = new printdialog(); if (pd.showdialog() != true) return; // create document fixeddocument document = new fixeddocument(); document.documentpaginator.pagesize = new size(pd.printableareawidth, pd.printableareaheight); // create page fixedpage page1 = new fixedpage(); page1.width = document.documentpaginator.pagesize.width; page1.height = document.documentpaginator.pagesize.height; // add text page textblock page1text = new textblock(); page1text.text = "this text" page1text.fontsize = 12; // 30pt text page1text.margin = new thickness(50); // 1 inch margin page1.children.add(page1text); // add page document pagecontent page1content = new pagecontent(); ((iaddchild)page1content).addchild(page1); document.pages.add(page1content); // , print pd.printdocument(document.documentpaginator, "print");
instead of printdialog class, try using printdocument class directly, can set printer name:
using system.drawing.printing; printdocument pd = new printdocument(); pd.printersettings.printername = "my printer";
to loop through available printer names:
foreach (string s in printersettings.installedprinters) { // }
Comments
Post a Comment