I want to share a solution to this without need to do any of this:
1) The document used on the AwareIM Template has to be a macro ready document and needs to have this macro:
Code: Select all
' The Word macro for exporting to PDF (the Word window closes after finishing)
Sub ExportToPDFext()
ActiveDocument.TablesOfContents(1).Update
ChangeFileOpenDirectory ThisDocument.Path
ActiveDocument.ExportAsFixedFormat _
OutputFileName:=Left(ActiveDocument.FullName, InStrRev(ActiveDocument.FullName, ".")) + "pdf", _
ExportFormat:=wdExportFormatPDF, _
OpenAfterExport:=False, _
OptimizeFor:=wdExportOptimizeForPrint, _
Range:=wdExportAllDocument, _
From:=1, _
To:=1, _
Item:=wdExportDocumentContent, _
IncludeDocProps:=True, _
KeepIRM:=True, _
CreateBookmarks:=wdExportCreateNoBookmarks, _
DocStructureTags:=True, _
BitmapMissingFonts:=True, _
UseISO19005_1:=False
Application.Quit SaveChanges:=wdDoNotSaveChanges
End Sub
3) A EXECUTE PROGRAM using this command lines on Word, will do the thing.
Code: Select all
"C:\Program Files\Microsoft Office 15\root\o
ffice15\WINWORD.EXE" /mExportToPDFext /q "YOURDOCUMENT.doc"
/q don't show the splashscreen and don't show word
And the macro already have a line to update tables of contents so your documents keeps updated after being processed by aware.
Cheers.