printing

C# WinForms Print Entire Form

ぐ巨炮叔叔 提交于 2019-12-18 05:24:11
问题 I have a single window, WinForms app (with multiple text boxes) and I need to print the entire form once a 'Print" button is clicked. I have looked up examples to do this but I cannot find anything that will print the entire form including all text boxes. Is there a simple way to do this? 来源: https://stackoverflow.com/questions/896074/c-sharp-winforms-print-entire-form

Printing the contents of a WPF WebBrowser

别来无恙 提交于 2019-12-18 05:21:51
问题 I'm trying to print the contents of a WPF WebBrowser control so that no print dialog is shown, but am having no luck. I have tried the following and am sure it did work: PrintDialog printDialog = new PrintDialog(); printDialog.PrintDocument(((IDocumentPaginatorSource)browser.Document).DocumentPaginator, "My App"); but for some reason, I'm now getting the following exception: Unable to cast COM object of type 'mshtml.HTMLDocumentClass' to interface type 'System.Windows.Documents

Printing HTML in Python CGI

只愿长相守 提交于 2019-12-18 05:21:36
问题 I've been teaching myself python and cgi scripting, and I know that your basic script looks like #!/usr/local/bin/python import cgi print "Content-type: text/html" print print "<HTML>" print "<BODY>" print "HELLO WORLD!" print "</BODY>" print "</HTML>" My question is, if I have a big HTML file I want to display in python (it had lines and lines of code and sone JS in it) do I have to manually add 'print' in front of each line and turn "s into \" , etc? Or is there a method or script that

Removing input placeholder on a printable version of an html page

冷暖自知 提交于 2019-12-18 04:34:25
问题 I have a form with input fields. Each input field has a placeholder attribute. There is also a link displaying the printable version of the same form. My problem is that if I leave the placeholder attribute unchanged and the input field is empty, then the placeholder is actually printed, which is not very good. I am looking for a way to resolve this unfortunate behavior. Right now, the only thing I can think of is traverse the DOM in javascript and remove all the placeholder attributes when

Sending raw data to FedEx Label printer

微笑、不失礼 提交于 2019-12-18 04:25:06
问题 I'm working on a .NET WinForms app that needs to print a FEDEX shipping label. As part of the FedEx api, I can get raw label data for the printer. I just don't know how to send that data to the printer through .NET (I'm using C#). To be clear, the data is already pre formatted into ZPL (Zebra printer language) I just need to send it to the printer without windows mucking it up. 回答1: C# doesn't support raw printing, you'll have to use the win32 spooler, as detailed in this KB article How to

How to print multiple WPF pages in one document

早过忘川 提交于 2019-12-18 04:23:20
问题 I want to create a document with several pages and with one wpf window depicted on each page. I managed to print one window using PrintDialog and PrintVisual. However this seem to only work with one single page? Any ideas how I can build a document with several pages and print the complete set. Can I insert that visual (referred in code) and insert it as a page in a document and print it after that? Is approach really bad? Is there som other way to solve this problem? Sub Print (Dim ele As

iTextSharp to print a gridview

亡梦爱人 提交于 2019-12-18 04:15:02
问题 I use iTextSharp to print a grid view but I face some problems: No arabic characters appears at all. The direction is LTR and I wany it RTL instead. Some columns in the gridview are templatefields (label, imagebutton,...), and I can't handle this case. I won't show all of them (like delete button , ...) The code : protected void ExportToPDF(GridView gvReport, bool LandScape) { int noOfColumns = 0, noOfRows = 0; DataTable tbl = null; if (gvReport.AutoGenerateColumns) { tbl = gvReport

Load image from file and print it using WPF… how?

戏子无情 提交于 2019-12-18 04:12:33
问题 I'm looking for an example of how to load an image from file and print it on a page using WPF. I'm having a hard time finding good information about WPF printing. 回答1: var bi = new BitmapImage(); bi.BeginInit(); bi.CacheOption = BitmapCacheOption.OnLoad; bi.UriSource = new Uri(""); bi.EndInit(); var vis = new DrawingVisual(); using (var dc = vis.RenderOpen()) { dc.DrawImage(bi, new Rect { Width = bi.Width, Height = bi.Height }); } var pdialog = new PrintDialog(); if (pdialog.ShowDialog() ==

JavaScript print blocked by Chrome, Workaround?

南笙酒味 提交于 2019-12-18 03:56:19
问题 I know it has been discussed here before, yet I found no practical solution/workaround for this, I'm hoping if someone has any idea how to resolve this problem! Here's it is: If you try to call window.print() method frequently within a single page(as if a user clicks on a print button) in google Chrome, the browser throws a warning message in the console, stating: Ignoring too frequent calls to print() And nothing happens! After several seconds, things go back to normal and print dialog

How to add “ ” quotes around printed String? [duplicate]

♀尐吖头ヾ 提交于 2019-12-18 03:32:45
问题 This question already has answers here : How can I make Java print quotes, like “Hello”? (10 answers) Closed 6 years ago . I want to print inverted quotes in java. But how to print it? for(int i=0;i<hello.length;i++) { String s=hello[i].toLowerCase().trim(); System.out.println(""+s+""); } expected OP: "hi"..... 回答1: Because double quotes delimit String values, naturally you must escape them to code a literal double quote, however you can do it without escaping like this: System.out.println('"