printing

Perl: Print on the “display” and also into a file

こ雲淡風輕ζ 提交于 2020-01-10 05:13:40
问题 Is there any way to print both onto the "display" and also into a file at the same time without repeating the print "string" code? What I want to do: if ($ofile) { open (FILE, '>>', "file"); print "Hello" #some code#; #prints on the display and into the file } instead of: if ($ofile) { open (FILE, '>>', "file"); } print "Hello"; if ($ofile) { print FILE "Hello"; } Tried googling but all I found was either or, not both features together. Edit to add questions: Then use IO::Tee to create a new

Saving RichTextBox FlowDocument to image

[亡魂溺海] 提交于 2020-01-10 03:17:26
问题 i'am making a programm where i want my RichTextBox content (text+images) to be saved as an image (jpg/png). I tried to use this solution but i get only black filled image from SaveUIAsGraphicFile() I also tried to create FormattedText from my rtb control, printing it works fine, but its not possible to insert images in there. Maybe it is possible to print FlowDocument somehow? 回答1: You could use something like the following method to create a bitmap from a FlowDocument: public BitmapSource

A Text Table Writer/Printer for Python

牧云@^-^@ 提交于 2020-01-10 01:47:50
问题 TL;DR -> Is there a table writing module on PyPi (I've failed to find any) that takes in lists as parameters and makes a table out of those lists. I am asking this because I've looked on PyPI, but I have not found anything similar to actually printing strings or writing strings to files. Imagine having a lot of statistics, and having to write them down neatly in a table, like this, (I've been trying to teach a class about the differences between the different sorting algorithms out there)

wkhtmltopdf: What paper sizes are valid?

梦想的初衷 提交于 2020-01-09 19:25:19
问题 I am using wkhtmltopdf(html to pdf converter) and am running it through a php shell_exec . When running wkhtmltopdf --help one option is size, with the help text being Set paper size to: A4, Letter, etc. I am wondering if someone has a list of paper sizes this executable will run? The specific version is wkhtmltopdf-0.9.9-static-i386 回答1: If you take a look through the pdfsettings.cc source in the project repository, you'll find this list, which looks to me like the accepted list of named

Printing to printers in PHP

半世苍凉 提交于 2020-01-09 10:58:50
问题 I'm trying to set up a CLI PHP application to print a set of web pages to a default or specified printer. I'm on a Windows 7 machine with PHP 5.2.11 running in a CLI. To test the print functionality I've loaded PHP_printer.dll and I'm printing to Onenote, a print to file option, using the exact printer name given in PRINTER_ENUM_LOCAL. Update : Here's the latest code: $handle = printer_open("Send To OneNote 2010"); printer_start_doc($handle, "My Document"); printer_start_page($handle);

Center text for receipt printing

故事扮演 提交于 2020-01-09 10:58:05
问题 I have some code which I'm using to print a receipt from C#. The code below prints OK but I'm struggling with aligning the text left right and center, Graphics graphics = e.Graphics; Font font = new Font("Courier New", 10); float fontHeight = font.GetHeight(); int startX = 0; int startY = 0; int Offset = 0; graphics.DrawString("Welcome to MSST", new Font("Courier New", 14), new SolidBrush(Color.Black), startX, startY + Offset); Offset = Offset + 20; graphics.DrawString("Recept No :" +

Determine the IP Address of a Printer in C#

跟風遠走 提交于 2020-01-09 10:51:33
问题 I would like to determine the IP address of a printer, using C# (.NET 2.0). I have only the printer share name as set up on the Windows OS, in the format \\PC Name\Printer Name . The printer is a network printer, and has a different IP address to the PC. Does anyone have any pointers? Thanks in advance for your help. Regards, Andy. 回答1: Check this question: How to get Printer Info in C#.NET?. I think that you have to get the property PortName from the WMI properties. 回答2: Just adding an

Determine the IP Address of a Printer in C#

喜欢而已 提交于 2020-01-09 10:51:03
问题 I would like to determine the IP address of a printer, using C# (.NET 2.0). I have only the printer share name as set up on the Windows OS, in the format \\PC Name\Printer Name . The printer is a network printer, and has a different IP address to the PC. Does anyone have any pointers? Thanks in advance for your help. Regards, Andy. 回答1: Check this question: How to get Printer Info in C#.NET?. I think that you have to get the property PortName from the WMI properties. 回答2: Just adding an

Printing hex values in x86 assembly

感情迁移 提交于 2020-01-09 10:32:32
问题 I need to make a routine that will convert a memory address into a string of bytes. That string would then be the input for a function that prints null-terminated strings (which I was already able to make). For example, if I have an address 0x1bf9 I need to print the text "1bf9" to the screen. The book hasn't gone into 32 bit mode yet, but it kind of hinted that we would need it for that too. This is what I have so far: TABLE: db "0123456789ABCDEF", 0 STRING: db 0 hex_to_char: lea bx, TABLE

How to show printer properties/preferences dialog and save changes?

时光怂恿深爱的人放手 提交于 2020-01-09 09:39:54
问题 EDIT: My fault! I expected the changes to be written back to the default printer settings when in fact only the local instance of the PrinterSettings are changed. - The below code seems to work as intended I am trying to show the custom printer properties of a given printer. I need this as part of a custom PrintDialog which I am trying to write. Most of the examples that I can find online manage to show the dialog but any changes the user might make are lost which makes it useless. Example: