akjal

Hi,

I have a document. I need to print the document to a pdf file. I have installed a pdf printer driver (3rd party driver)

Manually,when I open a document and click on Print on File Menu , I can select the pdf printer driver and can print the document to a pdf file.

I need this to be done through dotnet code. That is , Select a file from disk and click on button to print. When that print button clicks, should do all the above.

can anybody help.

thanks in advance...

akjal



Re: .NET Base Class Library How to print any office document in c#

Inbar Gazit - MSFT

First, you need to add the Microsoft.Office.Core.Word.dll to your project as reference so you can use the Word Object Model in your sources.

First set the ActivePrinter property (on the Word.Application object) to the printer you want and then look into the Document.Print method to do what you need.

There are many parameters and some can be just Type.Missing as you don't need them.

You can PrintToFile if you so choose.






Re: .NET Base Class Library How to print any office document in c#

boyi

You can use the itext(3rd party library),it is for the pdf,you can download the document with itext,you can get helf from here:

http://www.ujihara.jp/iTextdotNET/en/

http://itextdocs.lowagie.com/tutorial/

good luck!