Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print MS Word Doc to PDF using Distiller/Adobe PDF

Status
Not open for further replies.

reffek

Programmer
Apr 7, 2005
24
US
I'm trying to print to "Adobe PDF" (aka Distiller) but the document just spools forever and never prints. I can do it manually, but my VB.NET code can't do it.

Code:
Imports Word = Microsoft.Office.Interop.Word

Dim avmReportWord As New Word.Application
Dim avmReportDoc As Word.Document
avmReportWord.Visible = False
avmReportDoc = avmReportWord.Documents.Add

'Bunch of code here to create paragraphs and text and whatnot

avmReportDoc.SaveAs("c:\AVM_Working_Directory\" & avmReportDocFileName)
Dim oldActivePrinter As String = avmReportWord.ActivePrinter
               avmReportWord.ActivePrinter = "Adobe PDF"
               avmReportWord.PrintOut(FileName:="" & avmReportDocFileName, Range:=Word.WdPrintOutRange.wdPrintAllDocument, Item:=Word.WdPrintOutItem.wdPrintDocumentContent, PageType:=Word.WdPrintOutPages.wdPrintAllPages, Background:=True, PrintToFile:=False, Copies:=1)
avmReportWord.ActivePrinter = oldActivePrinter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top