I use System.Drawing.Printing.PrintDocument to print in a Windows Desktop app. Here’s the code:
PrintDocument pd = new PrintDocument();
pd.PrinterSettings.PrinterName = pr; // assign printer name
pd.PrintPage += new PrintPageEventHandler(this.PrintOutput);
pd.Print();
When I use the Virtual UI and PrintDocument method and choose ‘Thinfinity VirtualUI’ as the printer name, the web browser will popup a preview window and I can print easily without changing any c# code from the Windows Desktop app.
https://www.cybelesoft.com/manuals/thinfinity/virtualui/index.html?printing.html
Does Wisej have anything like this? If not, what’s Wisej solution to preview and print a document?
A full implementation of the PrintPreviewDialog and PrintPreviewControl is here:
https://github.com/iceteagroup/wisej-extensions/tree/2.2/Wisej.Web.Ext.PrintPreview
Supports both PDF and WMF modes.
It’s actually a lot easier than I thought with Wisej. I will attach a simple PrintPreviewDialog and PrintPreviewControl next week.
The usage is as simple as in winforms without code changes:
PrintDocument pd = new PrintDocument(); pd.PrintPage += OnPrintPage; pd.DocumentName = "Test"; this.printDocumentViewer1.Document = pd; private void OnPrintPage(object sender, PrintPageEventArgs e) { e.Graphics.DrawString("TEST", this.Font, SystemBrushes.ControlText, 10, 10); e.HasMorePages = false; }
You can use System.Drawing.Printing.PrintDocument but it will create the document on the server. Then you can download it to the browser and print using Application.DownloadAndOpen(). You just need to create a supported format, which is most likely a pdf.
Virtual UI is not a web system, it’s a remote desktop system rendered through the browser. Wisej creates web applications managed by the browser, so the printing is entirely up to the browser. To preview a document, create a pdf and preview it using the PdfViewer or an iframe or any third party javascript preview widget.
Please login first to submit.