printing

Printing RichTextBox

被刻印的时光 ゝ 提交于 2019-12-29 07:12:37
问题 I am making a simple WinForms App and I wanted to allow the user to print the Text from RichTextBox. I followed MSDN link then.. And it works for a real printer (by real I mean that one I can touch:) ) But what if I want use some kind of PDF Printer? Then I must say it works when only one page is printed. Every next page is being printed on the same, first page , which means the text is being overprinted. This is obvious, but what I can do do force PDF Printer to create a new Page? This is my

Printing using Word Interop with Print Dialog

妖精的绣舞 提交于 2019-12-29 06:53:01
问题 I'm trying to print a word doc from my C# code. I used the 12.0.0.0 Word Interop and what i'm trying to do is to get a Print Dialogue pop up before the document prints. I'm not 100% sure of the syntax of all of this as I can't get my code to work :( Any ideas? Thanks in advance! 回答1: It should be something along the lines of: object nullobj = Missing.Value; doc = wordApp.Documents.Open(ref file, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref

Printing using Word Interop with Print Dialog

╄→尐↘猪︶ㄣ 提交于 2019-12-29 06:52:09
问题 I'm trying to print a word doc from my C# code. I used the 12.0.0.0 Word Interop and what i'm trying to do is to get a Print Dialogue pop up before the document prints. I'm not 100% sure of the syntax of all of this as I can't get my code to work :( Any ideas? Thanks in advance! 回答1: It should be something along the lines of: object nullobj = Missing.Value; doc = wordApp.Documents.Open(ref file, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref

PDF Watermark for printing only, programmatically

前提是你 提交于 2019-12-29 06:33:30
问题 I can watermark any PDF already, and the images inside, everything ok, but now I need the watermark only showing up when the PDF is printed... Is this possible? How? I need to do this programmatically of course. 回答1: You should probably make use of the fact that the screen uses RGB and the printer CMYK. You should be able to create two colors in CMYK that map to the same RGB value. This is of course not enough against a determined specialist. 回答2: For future readers, this is possible to do by

Unprint a line on the console in Python?

女生的网名这么多〃 提交于 2019-12-29 06:27:09
问题 Is it possible to manipulate lines of text that have already been printed to the console? For example, import time for k in range(1,100): print(str(k)+"/"+"100") time.sleep(0.03) #>> Clear the most recent line printed to the console print("ready or not here I come!") I've seen some things for using custom DOS consoles under Windows, but I would really like something that works on the command_line like does print without any additional canvases. Does this exist? If it doesn’t, why not? P.S.: I

Printing a Tree data structure in Python

喜你入骨 提交于 2019-12-29 05:45:28
问题 I was looking for a possible implementation of tree printing, which prints the tree in a user-friendly way, and not as an instance of object. I came across this solution on the net: source: http://cbio.ufs.ac.za/live_docs/nbn_tut/trees.html class node(object): def __init__(self, value, children = []): self.value = value self.children = children def __repr__(self, level=0): ret = "\t"*level+repr(self.value)+"\n" for child in self.children: ret += child.__repr__(level+1) return ret This code

How do I specify the printer I want to use in Java?

十年热恋 提交于 2019-12-29 05:34:09
问题 Currently retrieving the default printer installed on my machine for printing. I want to be able to pick which printer the documents go to. What is the best method of doing this ? Code: PrintService[] services = PrintServiceLookup.lookupPrintServices(psInFormat, null); System.out.println("Printer Selected " + services[Printerinx]); //PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService(); DocFlavor[] docFalvor = services[Printerinx].getSupportedDocFlavors(); for (int i =

Google Chrome Extension: Print the page silently

守給你的承諾、 提交于 2019-12-29 04:14:07
问题 I'm developing an internal Google Chrome Extension that needs a way to initiate print the current page to the printer. I do not want the default Print dialog to come up (so, javascript:window.print() is out of question). As far as I understand, this is not possible just with the JS + HTML plug-in, so I'm also open to using the NPAPI plugin also (with a dummy mime-type). And I'm concerned for Windows platform only. I'm also open for various hacks / workarounds if possible, though a standard

How do I print an HTML document from a web service?

你说的曾经没有我的故事 提交于 2019-12-29 03:49:25
问题 I want to print HTML from a C# web service. The web browser control is overkill, and does not function well in a service environment, nor does it function well on a system with very tight security constraints. Is there any sort of free .NET library that will support the printing of a basic HTML page? Here is the code I have so far, which does not run properly. public void PrintThing(string document) { if (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA) { Thread thread = new

Printing image with PrintDocument. how to adjust the image to fit paper size

血红的双手。 提交于 2019-12-29 03:33:12
问题 In C#, I am trying to print an image using PrintDocument class with the below code. The image is of size 1200 px width and 1800 px height. I am trying to print this image in a 4*6 paper using a small zeebra printer. But the program is printing only 4*6 are of the big image. that means it is not adjusting the image to the paper size ! PrintDocument pd = new PrintDocument(); pd.PrintPage += (sender, args) => { Image i = Image.FromFile("C://tesimage.PNG"); Point p = new Point(100, 100); args