I have a function that currently prints a document with a header and footer. However, the function does not display the Print dialog. I want to create a similar function that adds the header and footer, but displays the Print dialog so they can print it to a PDF file. Is it possible to use the ActiveXObject to display the Print dialog?
Here is the code I currently have that prints automatically:
[CODE]printWord = function() {
var str;
var objWord;
var url=”C:\Users\ccote1\Desktop\Baseline Diffs\comparison794TableTest2.html”;
objWord = new ActiveXObject(“Word.Application”);
objWord.Documents.Open(url);
ActiveDocument = objWord.Documents(1);
ActiveDocument.Tables(1).Delete();
ActiveDocument.Sections(1).Headers(1).Range.Text = “For Official Use Only (FOUO)”;
ActiveDocument.Sections(1).Headers(1).Range.ParagraphFormat.Alignment = 1; // 1 = center
ActiveDocument.Sections(1).Headers(1).Range.Font.Name = “Arial”;
ActiveDocument.Sections(1).Headers(1).Range.Font.Size = 12;
ActiveDocument.Sections(1).Headers(1).Range.Font.Bold = true;
ActiveDocument.Sections(1).Footers(1).Range.Text = “For Official Use Only (FOUO)”;
ActiveDocument.Sections(1).Footers(1).Range.ParagraphFormat.Alignment = 1; // 1 = Center
ActiveDocument.Sections(1).Footers(1).Range.Font.Name = “Arial”;
ActiveDocument.Sections(1).Footers(1).Range.Font.Size = 12;
ActiveDocument.Sections(1).Footers(1).Range.Font.Bold = true;
ActiveDocument.Sections(1).PageSetup.PaperSize = 1; //1 = 11×17, 2 = Letter (8.5×11)
ActiveDocument.Sections(1).PageSetup.Orientation = 1; //0 = Portrait, 1 = Landscape
ActiveDocument.Sections(1).PageSetup.TopMargin = 36;
objWord.Visible = false;
objWord.PrintOut();
alert(“Your document has printed successfully.”);
ActiveDocument.Close(0);
objWord.Quit(0);
}
I would appreciate any help I can get.
Chris