We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Not able to remove the comments converting Word to PDF using Aspose.Word

Hi,

We tried the latest version of Aspose Word 14.7.0.0 to save Word documents into PDF. We used the following code to take out the comments from Word.

// Collect all comments in the document
NodeCollection comments = doc.GetChildNodes(NodeType.Comment, true);
// Remove all comments.
comments.Clear();

Saving to word document successfully removed the comments, but saving to PDF did not. Please advise!
We are using Aspose Word .NET with MS Office 2013 on Windows 7 x64 machines.
Regards,
Jason

Hi Jason,

Thanks for your inquiry. Could you please attach your input Word document here for testing? I will investigate the issue on my side and provide you more information.

Hi Tahir,

Thanks for looking into this! I just built a dummy file. Nothing unusual.

Regards,

Jason

Hi Jason,

Thanks for sharing the document. I have tested the scenario using following code example with latest version of Aspose.Words for .NET 14.8.0 and have not found the shared issue. Please use Aspose.Words for .NET 14.8.0. I have attached the output Pdf with this post for your kind reference.

Document doc = new Document(MyDir + "Test+document+with+Comments.docx");
// Collect all comments in the document
NodeCollection comments = doc.GetChildNodes(NodeType.Comment, true);
// Remove all comments.
comments.Clear();
doc.Save(MyDir + "Out.pdf");

Hi Tahir,
Sorry to reply you late. We’re using the version doc.Save(memoryStream, saveOptions), which does not work.
Regards,
Jason

Hi Jason,

Thanks for your inquiry. I have tested the scenario using following code example and have not found any issue with output Pdf file. Please make sure that you attached the correct input document and using the latest version of Aspose.Words for .NET 14.8.0.

If you still face problem, please share your input document again along with output Pdf file which shows the undesired behavior. Please create a standalone/runnable simple application (for example a Console Application Project) that demonstrates the code you used to generate your output document.

I will investigate the issue on my side and provide you more information.

Document doc = new Document(MyDir + "Test+document+with+Comments.docx");
// Collect all comments in the document
NodeCollection comments = doc.GetChildNodes(NodeType.Comment, true);
// Remove all comments.
comments.Clear();
MemoryStream stream = new MemoryStream();
PdfSaveOptions options = new PdfSaveOptions();
options.SaveFormat = SaveFormat.Pdf;
doc.Save(stream, options);
File.WriteAllBytes(MyDir + "Out.pdf", stream.ToArray());