printing

Using javascript to print images

好久不见. 提交于 2019-12-17 10:37:24
问题 I would like to know if it's possible to use javascript to open a popup window containing an image, and at the same time have the print dialog show. Once someone clicks on print, the popup closes. Is this easily attainable? 回答1: popup = window.open(); popup.document.write("imagehtml"); popup.focus(); //required for IE popup.print(); 回答2: Another great solution!! All credit goes to Codescratcher <script> function ImagetoPrint(source) { return "<html><head><scri"+"pt>function step1(){\n" +

How to create a virtual printer in Windows?

点点圈 提交于 2019-12-17 10:18:00
问题 I want to create a virtual printer driver for Windows. How and where can I start properly? The WDK has some printing drivers examples that do not seems a good introductory. MSDN also doesn't seems to be very helpful for a novice. There are a lot of virtual printers for Windows out there (mostly they generate PDFs), I wonder if someone could tell my how can I do the same? Any links to the elaborating documentations are appreciated in advance. Thanks. 回答1: When I did it (which about 12 years

redirect prints to log file

懵懂的女人 提交于 2019-12-17 10:17:17
问题 Okay. I have completed my first python program.It has around 1000 lines of code. During development I placed plenty of print statements before running a command using os.system() say something like, print "running command",cmd os.system(cmd) Now I have completed the program. I thought about commenting them but redirecting all these unnecessary print (i can't remove all print statements - since some provide useful info for user) into a log file will be more useful? Any tricks or tips. 回答1:

C# Printing (RichTextBox)

佐手、 提交于 2019-12-17 09:48:31
问题 I want to print the content of my RichTextBox (eintragRichTextBox) I have now this code: private void druckenPictureBox_Click(object sender, EventArgs e) { PrintDialog printDialog = new PrintDialog(); PrintDocument documentToPrint = new PrintDocument(); printDialog.Document = documentToPrint; if (printDialog.ShowDialog() == DialogResult.OK) { StringReader reader = new StringReader(eintragRichTextBox.Text); documentToPrint.Print(); documentToPrint.PrintPage += new PrintPageEventHandler

How to set the plot in matlab to a specific size?

橙三吉。 提交于 2019-12-17 09:42:11
问题 Generally, I wish to plot a rather complex x-y plot (lots of overlapping curves) to an A3 format so: A4 210x297 A3 = A4*2 = 420 x 297 ... - 10mm each side = 400 x 277 (size of desired plot window) What is the easiest way to set the size of the plot so it fits that size when printed in PDF (or any other common output format)? 回答1: See the matlab documentation for figure properties. Namely: PaperSize - Explicitly defines the size of the canvas. PaperType - Sets PaperSize to one of several

Print to specific printer (IPP URI) in Java

别说谁变了你拦得住时间么 提交于 2019-12-17 08:59:52
问题 Is there any way in Java to print to a specific IPP printer? All of the sample code and tutorials I've found focus on how to print a particular type of document, using something like the following: DocFlavor flavor = DocFlavor.INPUT_STREAM.POSTSCRIPT; PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); aset.add(MediaSizeName.ISO_A4); PrintService[] pservices = PrintServiceLookup.lookupPrintServices(flavor, aset); if (pservices.length > 0) { DocPrintJob pj = pservices[0]

Printing PDFs from Windows Command Line

为君一笑 提交于 2019-12-17 08:54:13
问题 I'm trying to print all pdfs in current dir. When I call this bash script in cmd ( singlepdf.sh ): '"C:\Program Files (x86)\Adobe\Reader 10.0\Reader\AcroRd32.exe"' /t Gemeinde_348_BioID_842_alt.pdf everything's working fine. When calling multiplepdfs.sh with this content: declare -a pdfs=(*.pdf) for pdf in ${pdfs[@]}; do echo -e "\nprinting **$pdf** with AcroRd32.exe...\n" '"C:\Program Files (x86)\Adobe\Reader 10.0\Reader\AcroRd32.exe"' /t $pdf sleep 3 done The echo shows that files are

C++ format macro / inline ostringstream

你离开我真会死。 提交于 2019-12-17 08:53:33
问题 I'm trying to write a macro that would allow me to do something like: FORMAT(a << "b" << c << d) , and the result would be a string -- the same as creating an ostringstream, inserting a...d , and returning .str() . Something like: string f(){ ostringstream o; o << a << "b" << c << d; return o.str() } Essentially, FORMAT(a << "b" << c << d) == f() . First, I tried: 1: #define FORMAT(items) \ ((std::ostringstream&)(std::ostringstream() << items)).str() If the very first item is a C string (

How do I change the string representation of a Python class? [duplicate]

独自空忆成欢 提交于 2019-12-17 07:15:27
问题 This question already has answers here : How to print instances of a class using print()? (9 answers) Closed last year . In Java, I can override the toString() method of my class. Then Java's print function prints the string representation of the object defined by its toString() . Is there a Python equivalent to Java's toString() ? For example, I have a PlayCard class. I have an instance c of PlayCard. Now: >>> print(c) <__main__.Card object at 0x01FD5D30> But what I want is something like: >

How do I change the string representation of a Python class? [duplicate]

廉价感情. 提交于 2019-12-17 07:15:21
问题 This question already has answers here : How to print instances of a class using print()? (9 answers) Closed last year . In Java, I can override the toString() method of my class. Then Java's print function prints the string representation of the object defined by its toString() . Is there a Python equivalent to Java's toString() ? For example, I have a PlayCard class. I have an instance c of PlayCard. Now: >>> print(c) <__main__.Card object at 0x01FD5D30> But what I want is something like: >