1 uses ComObj;
 2 procedure TForm1.Button1Click(Sender: TObject);
 3 var
 4    wdo,wdoc,wdocs : OleVariant;
 5 begin
 6   wdo := CreateOleObject('Word.Application');
 7   wdocs := wdo.Documents;
 8   wdo.ActivePrinter := 'Acrobat PDFWriter';
 9   wdoc := wdocs.Open('C:\docfile.docx');
10   //另存为的方法可以用saveas
11   wdoc.ExportAsFixedFormat('C:\pdffile.pdf',
12                         17, false,
13                         EmptyParam,
14                         EmptyParam,
15                          EmptyParam,
16                         EmptyParam, EmptyParam,
17                          true,
18                         true, true, true,
19                         true, false,
20                         EmptyParam);
21 
22  //虚拟打印机的方法
23  wdoc.PrintOut(0, 0, 0,'C:\pdffile.pdf');
24 
25 end;
 1 uses ComObj;
 2 procedure TForm1.Button1Click(Sender: TObject);
 3 var
 4    wdo,wdoc,wdocs : OleVariant;
 5 begin
 6   wdo := CreateOleObject('Word.Application');
 7   wdocs := wdo.Documents;
 8   wdo.ActivePrinter := 'Acrobat PDFWriter';
 9   wdoc := wdocs.Open('C:\docfile.docx');
10   //另存为的方法可以用saveas
11   wdoc.ExportAsFixedFormat('C:\pdffile.pdf',
12                         17, false,
13                         EmptyParam,
14                         EmptyParam,
15                          EmptyParam,
16                         EmptyParam, EmptyParam,
17                          true,
18                         true, true, true,
19                         true, false,
20                         EmptyParam);
21 
22  //虚拟打印机的方法
23  wdoc.PrintOut(0, 0, 0,'C:\pdffile.pdf');
24 
25 end;

 

posted on 2016-05-26 10:36  东睿软件工作室  阅读(4084)  评论(0编辑  收藏  举报