We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Silent Printing

Thread ID:

Created:

Updated:

Platform:

Replies:

101214 Oct 7,2011 04:14 AM Oct 31,2011 01:30 AM ASP.NET Web Forms (Classic) 3
loading
Tags: PDF
Ernest Morariu
Asked On October 7, 2011 04:14 AM


Hello !

I would like to know whether it is possible with your technology to print silently a pdf document in a WindowsForms application.
What I mean, is it there an object(like PdfViewer) to which I can pass the printer name and eventually the printer settings and then call a method like Print to send the document to the printer without making anything visible on the screen?

Thank you !
Ernest Morariu


Geetha M [Syncfusion]
Replied On October 11, 2011 07:35 AM

Hi Ernest,

Thank you for your interest in Syncfusion products.

Yes. It is possible to start silent printing with the help of Essential Pdf Viewer for Windows using the following code snippet:

PrintDialog dialog = new PrintDialog();
dialog.AllowPrintToFile = true;
dialog.AllowSomePages = true;
dialog.PrinterSettings.FromPage = 1;
dialog.PrinterSettings.ToPage = pdfViewer1.PageCount;
dialog.PrinterSettings.PrinterName = "HP LaserJet";
dialog.Document = pdfViewer1.PrintDocument;

However, the print support has been added recently and if you can create a direct trac incident we will update you with further details about the patch to be installed to make use of it.

Please let me know if you have any questions.

Regards,
Geetha


Ernest Morariu
Replied On October 26, 2011 07:21 AM


Hi Geetha!

Now I have your last pdf components 9.4.0.62 with the license.
My UserId is: ernest.morariu@yumez.eu

Getting back to the subject "Silent Printing", I tried the sample you provided with the setup, I mean the project named "SilentPrinting", but it doesn't work.

In the button1_Click() the last line

dialog.Document = viewer.PrintDocument;

raises a FormatException(having InnerException = null) with the message "Input string was not in the correct format" and with the following StackTrace:
at System.Number.ParseSingle(String value, NumberStyles options, NumberFormatInfo numfmt)
at System.Single.Parse(String s)
at Syncfusion.PdfViewer.Base.ImageRenderer.RenderAsImage()
at Syncfusion.Windows.Forms.PdfViewer.PdfDocumentView.OnPrintPage(Object sender, PrintPageEventArgs e)
at System.Drawing.Printing.PrintController.PrintLoop(PrintDocument document)
at System.Drawing.Printing.PrintController.Print(PrintDocument document)
at System.Drawing.Printing.PrintDocument.Print()
at Syncfusion.Windows.Forms.PdfViewer.PdfDocumentView.get_PrintDocument()
at EssentialPDFSamples.Form1.button1_Click(Object sender, EventArgs e) in C:\Users\ernest.HQ\AppData\Local\Syncfusion\EssentialStudio\9.4.0.62\Windows\Pdf Viewer.Windows\Samples\2.0\Print\Silent Printing\CS\Form1.cs:line 164
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at EssentialPDFSamples.Form1.Main() in C:\Users\ernest.HQ\AppData\Local\Syncfusion\EssentialStudio\9.4.0.62\Windows\Pdf Viewer.Windows\Samples\2.0\Print\Silent Printing\CS\Form1.cs:line 152
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()


Thank you !
Ernest





Thank you for your interest in Syncfusion products.

Yes. It is possible to start silent printing with the help of Essential Pdf Viewer for Windows using the following code snippet:

PrintDialog dialog = new PrintDialog();
dialog.AllowPrintToFile = true;
dialog.AllowSomePages = true;
dialog.PrinterSettings.FromPage = 1;
dialog.PrinterSettings.ToPage = pdfViewer1.PageCount;
dialog.PrinterSettings.PrinterName = "HP LaserJet";
dialog.Document = pdfViewer1.PrintDocument;

However, the print support has been added recently and if you can create a direct trac incident we will update you with further details about the patch to be installed to make use of it.

Please let me know if you have any questions.

Regards,
Geetha



Geetha M [Syncfusion]
Replied On October 31, 2011 01:30 AM

Hi Ernest,

Thank you for the details.

I was able to reproduce the problem. Could you please create a direct trac incident so that we can update you with further details regarding this issue?

Regards,
Geetha


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;