How to remove comments from Word document and save to PDF using .NET

Having a comment in a word file creates strange looking pdfs. It adds a gray field on the right in every page.

files.zip (318.4 KB)

using v 20.7. settings:
var options = new PdfSaveOptions()
{
Compliance = PdfCompliance.PdfA1a,
ExportDocumentStructure = true,
FontEmbeddingMode = PdfFontEmbeddingMode.EmbedAll,
EmbedFullFonts = false,

            UseCoreFonts = false,
            PreserveFormFields = false, 
            HeaderFooterBookmarksExportMode = HeaderFooterBookmarksExportMode.All, 

            DisplayDocTitle = true
        };

@lars.olsson

You can remove the comment from PDF using LayoutOptions.ShowComments property as shown below.

document.LayoutOptions.ShowComments = false;
document.Save(MyDir+ "out.pdf", options);
1 Like

Thanks for the workaround.
I would probably not think this behaviour is strange if it only did it for the pages that had a comment. Well, it kind wrecks the visual congruency between the word file and the pdf file (maybe have it as more like a watermark?)

@lars.olsson

Please note that Aspose.Words mimics the behavior of MS Word. If you convert your document to PDF using MS Word, you will get the same output.

Hope your issue has been resolved. If you still face any issue while using Aspose.Words, please provide us your problematic and expected output documents. We will then answer your query accordingly.

I would assume this is fine by us. Thanks