2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
At present, there is no support for silent printing of the PDF document in the ASP.NET. However, you can achieve this by a workaround by using PdfViewer.Windows dll. In the following example, a Service reference is created and the PDF document is printed silently through the default printer. C# //Create an instance of PdfDocumentView. PdfDocumentView view = new PdfDocumentView(); //Load the document in the viewer as stream. view.Load(new MemoryStream(filestreamarray)); //Silently print the document through the default printer. view.PrintDocument.Print(); The following code example in Default.aspx.cs accesses the PrintService method in the Service reference. C# //Create an object reference for the Serviceclient. var client = new ServiceReference1.Service1Client("BasicHttpBinding_Service1"); if (System.IO.Path.GetExtension(FileUpload1.PostedFile.FileName).Equals(".pdf")) { //Get the stream of the file uploaded. Stream fileStream = FileUpload1.PostedFile.InputStream as Stream; MemoryStream memoryStream = new MemoryStream(); fileStream.CopyTo(memoryStream); byte[] byteArray = memoryStream.ToArray(); //Call the PrintService method in the service with filestream array as the parameter. client.PrintService(byteArray); } Sample Link: https://www.syncfusion.com/downloads/support/directtrac/general/PdfViewerWeb281456998.zip
|
2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
This page will automatically be redirected to the sign-in page in 10 seconds.