printing - Send multiple pdf files from one folder to printer. ASPOSE.PDF. C# -
i'm trying send multiple files 1 folder printer. now, can send 1 file folder printer. want print files folder. i'm using aspose.pdf trying modify next code without success:
using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using aspose.pdf; using system.drawing; using aspose.pdf.facades; namespace printer class programme { static void main(string[] args) { pdfviewer viewer = new pdfviewer(); viewer.bindpdf(@"c:\printing\hello.pdf"); system.drawing.printing.printersettings printersetting = new system.drawing.printing.printersettings(); printersetting.copies = 1; //specify number of copies printersetting.printername = "conan-printer"; // name of default printer used system.drawing.printing.pagesettings pagesetting = new system.drawing.printing.pagesettings(); pagesetting.papersource = printersetting.papersources[1]; //assign paper source pagesettings object //you can either specify index of tray or can loop through trays well. viewer.printdocumentwithsettings(pagesetting, printersetting); viewer.close(); } } }
you can re-create above code new method, accepts pdf file path argument. in main method, load files folder , phone call method each file. below example.
// load pdf files folder string folderpath = @"e:\loans\cirruslsdemo\hicodistributing"; string[] files = directory.getfiles(folderpath, "*.pdf"); // print pdf files 1 1 foreach (string pdffile in files) { printdocument(pdffile); } private void printdocument(string pdffile) { pdfviewer viewer = new pdfviewer(); viewer.bindpdf(pdffile); system.drawing.printing.printersettings printersetting = new system.drawing.printing.printersettings(); printersetting.copies = 1; //specify number of copies printersetting.printername = "conan-printer"; // name of default printer used system.drawing.printing.pagesettings pagesetting = new system.drawing.printing.pagesettings(); pagesetting.papersource = printersetting.papersources[1]; //assign paper source pagesettings object //you can either specify index of tray or can loop through trays well. viewer.printdocumentwithsettings(pagesetting, printersetting); viewer.close(); }
c# printing foreach aspose aspose.pdf
No comments:
Post a Comment