Created
October 16, 2017 14:04
-
-
Save melice/c1d0239506417f82ee2b5a5251e743ff to your computer and use it in GitHub Desktop.
office word docx save to pdf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program word2pdf; | |
{$APPTYPE CONSOLE} | |
{$R *.res} | |
uses | |
System.SysUtils, | |
System.Variants, | |
System.Win.ComObj, | |
Word2000, | |
Vcl.OleServer; | |
const | |
wdExportFormatPDF = 17; | |
var | |
Word, Doc: OleVariant; | |
begin | |
if ParamCount <> 2 then exit; | |
try | |
Word := CreateOLEObject('Word.Application'); | |
Doc := Word.Documents.Open( paramstr(1) ); | |
Doc.ExportAsFixedFormat( paramstr(2) , wdExportFormatPDF); | |
Word.ActiveDocument.Close(wdDoNotSaveChanges); | |
finally | |
{ Quit Word } | |
Word.Quit; | |
Word := Unassigned; | |
end; | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment