BoldDeskBoldDesk is now live on Product Hunt with a special offer: 50% off all plans. Let's grow together! Support us.
Hi Syncfusion team,
Trying to convert the docx to pdf but the comments is missing. Please assist.
Attached sample docx and code below.
Code:
using (MemoryStream memWord = new MemoryStream(fileBytes))
{
var wordDocument = new WordDocument(memWord, Syncfusion.DocIO.FormatType.Automatic);
// Creates a new instance of DocIORenderer class.
DocIORenderer render = new DocIORenderer();
// Converts Word document into PDF document.
PdfDocument pdf = render.ConvertToPDF(wordDocument);
// Save the PDF document.
pdf.Save(stream);
using (FileStream file = new FileStream(Path.Combine(Path.GetTempPath(), "test.pdf"), FileMode.Create, FileAccess.Write))
stream.WriteTo(file);
render.Dispose();
pdf.Close();
}
Regards
Hi Jinchuan,
On further analyzing the given details, we found that your requirement is to
preserve the comment in the converted PDF. To preserve the comment in converted
PDF, please set the CommentDisplayMode
API as ShowInBalloons
and then convert the Word document to PDF. So that the comments will be
preserved.
Code Snippet:
WordDocument wordDocument = new WordDocument(fileStream,FormatType.Docx)
//Sets ShowInBalloons to render a document comments in converted PDF document.
wordDocument.RevisionOptions.CommentDisplayMode = CommentDisplayMode.ShowInBalloons;
Please refer to the below UG documentation to know how to preserve
comments in a generated PDF
https://help.syncfusion.com/file-formats/docio/word-to-pdf?cs-save-lang=1&cs-lang=csharp#comments-in-word-to-pdf-conversion
If this post is helpful, please consider accepting it as the
solution so that other members can locate it more quickly.
Regards,
Akash.