Hi All,
I am using Essential DocIO 4.4.0.51 for printing document. After supplying these paperSource, numberOfCopies and printerName, calling the Print() from DLSViewer class. But the print action asking the printer selection dialog box. The requirement is, I don't want this dialog box again. Please help for good code.
Thanks in advance,
Rambabu
AD
Administrator
Syncfusion Team
November 4, 2008 11:22 AM UTC
Hi Rambabu,
DLSViewer was released as partially developed unadvertised utility. We do not provide support for DlsViewer and printing. As a workaround, you can use the following code to print your document without any prompt. But note that, this will need MsWord installed in your machine.
Process pr = new Process();
//this is used to print the document
pr.StartInfo.Verb = "Print";
pr.StartInfo.FileName = "Sample.doc";
pr.Start();
if (pr.Responding)
{
pr.CloseMainWindow();
}
else
{
pr.Kill();
}
Please let me know if you have any other concern.
Regards,
Dhivya
>Hi All,
I am using Essential DocIO 4.4.0.51 for printing document. After supplying these paperSource, numberOfCopies and printerName, calling the Print() from DLSViewer class. But the print action asking the printer selection dialog box. The requirement is, I don't want this dialog box again. Please help for good code.
Thanks in advance,
Rambabu
RP
Rambabu Pusala
November 4, 2008 11:30 AM UTC
Hi Dhivya,
Thanks for replay, I reached the answer as
public bool PrintDocument(string documentFilePath, string printerName, PaperSource paperSource,
int numberOfCopies, string documentName)
{
if (!File.Exists(documentFilePath)) return false;
DLSViewer viewer = new DLSViewer();
this.wordDoc = new WordDocument(documentFilePath);
viewer.Document = this.wordDoc;
viewer.PrintDocument.DocumentName = documentName;
viewer.PrintDocument.PrinterSettings.DefaultPageSettings.PaperSource = paperSource;
viewer.PrintDocument.PrinterSettings.Copies = (short)numberOfCopies;
viewer.PrintDocument.PrinterSettings.PrinterName = printerName;
viewer.PrintDocument.Print();
return true;
}
If there is any mistake, please guide for good.
Thanks,
Rambabu.
AD
Administrator
Syncfusion Team
November 5, 2008 12:39 PM UTC
Hi RamBabu,
As I said in my previous response, we don't recommend using DLS Viewer as it is not stable and complete. Also, we don't have an option to hide print dialog using DocIO. However, if this works for you, it is fine using it.
Please let me know if you have any other question.
Regards,
Dhivya.