From c91f33192e587d737a1462b6ff2f1cf4f70d99e5 Mon Sep 17 00:00:00 2001 From: Weirui Wang Date: Wed, 27 Dec 2023 15:53:53 +0800 Subject: [PATCH] Add the bookmarks in pdf when converting from word file. --- .../ConversionJobs/ConversionJob_Word.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Application/FileConverter/ConversionJobs/ConversionJob_Word.cs b/Application/FileConverter/ConversionJobs/ConversionJob_Word.cs index 36d3e54..2badad7 100644 --- a/Application/FileConverter/ConversionJobs/ConversionJob_Word.cs +++ b/Application/FileConverter/ConversionJobs/ConversionJob_Word.cs @@ -100,7 +100,18 @@ namespace FileConverter.ConversionJobs this.UserState = Properties.Resources.ConversionStateConversion; Diagnostics.Debug.Log("Convert word document to pdf."); - this.document.ExportAsFixedFormat(this.intermediateFilePath, Word.WdExportFormat.wdExportFormatPDF); + // this.document.ExportAsFixedFormat(this.intermediateFilePath, Word.WdExportFormat.wdExportFormatPDF); + this.document.ExportAsFixedFormat(this.intermediateFilePath, + Word.WdExportFormat.wdExportFormatPDF, + false, + Word.WdExportOptimizeFor.wdExportOptimizeForPrint, + Word.WdExportRange.wdExportAllDocument, + 1, 1, + Word.WdExportItem.wdExportDocumentContent, + true, + true, + Word.WdExportCreateBookmarks.wdExportCreateHeadingBookmarks, + true); Diagnostics.Debug.Log("Close word document '{0}'.", this.InputFilePath); this.document.Close(Word.WdSaveOptions.wdDoNotSaveChanges);