Choice 2: You can draw each page into a bitmap using the method IacDocument. DrawCurrentPage with the method System. The code in C should look like this:. You can use ghostscript to convert PDF into image formats. I found a slightly different version of your code that uses the printto verb. I didn't try it, but maybe it helps you:.
I know that the tag has Windows Forms ; however, due to the general title, some people might be wondering if they may use that namespace with a WPF application -- they may.
Now, this namespace must be used with a WPF application. It does not play well with ASP. NET or Windows Service. It should not be used with Windows Forms , as it has System.
I don't have a single issue with my PDF printing using the above code. I tried many things and the one that worked best for me was launching a SumatraPDF from the command line:.
My company offers Docotic. Pdf library that can render and print PDF documents. The article behind the link contains detailed information about the following topics:. If you're interested in commercial solutions which do exactly what you require then there are quite a few options. Here is a code sample key functions are PrintOptions and PrintDocument :. As of July , there is still no answer for the OP. There is no free way to 1 silently print your pdf for a 2 closed source project.
This means you must open your source code if giving the software, even for free, to anyone outside your company. Image, you can print it with. NET methods. Sadly, software to do this also requires payment or a GPL. How are we doing? Please help us improve Stack Overflow. Take our short survey. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams?
Collectives on Stack Overflow. Learn more. Asked 9 years, 5 months ago. Active 9 months ago. I've never had the need to render anything ASP. I already told you what to search for.
Go forth and search, then start reading. Add your solution here. OK Paste as. Treat my content as plain text, not as HTML. Existing Members Sign in to your account. This email is in use. Do you need your password? Submit your solution! When answering a question please: Read the question carefully. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question. Or are you just guessing? Accept Solution Reject Solution. PrintDocument can print anything you can "draw" using System. Graphics class which sadly, it does not support PDF, nor Docx, etc but just simple elements like lines, rects, ellipses, text and images.
Posted Jul am Marc Gabrie. Add your solution here. OK Paste as. Treat my content as plain text, not as HTML. Existing Members Sign in to your account. This email is in use. Do you need your password? Submit your solution! It is called after the Print method is called and before the first page of the document prints. Raises the EndPrint event. It is called when the last page of the document has printed. Raises the PrintPage event. It is called before a page prints.
Raises the QueryPageSettings event. It is called immediately before each PrintPage event. Occurs when the Print method is called and before the first page of the document prints. Occurs when the component is disposed by a call to the Dispose method. Occurs immediately before each PrintPage event. Skip to main content.
This browser is no longer supported. Download Microsoft Edge More info. Contents Exit focus mode. Print Document Class Reference Is this page helpful? Please rate your experience Yes No. Any additional feedback?
0コメント