Aspose word- convert word document with comment to PDF

I would like to convert the word file to PDF. See the attachment.
I would like to keep the changes and comment in the PDF, can aspose word do ?

Hi Chris,

Thanks for your inquiry. We have converted your “Testing.doc” to PDF format and attached it here for your reference. The PDF was generated using the licensed latest version of Aspose.Words for .NET 16.2.0. Please tell us if you’re satisfied with this output or let us know if we can be of any further assistance.

Best regards,

I discover a problem that, if the Word Document(.doc) is from Microsoft word 2003 version, the comment will disappear when save to pdf, but the Word Document (.doc) is from version 2007 or later, it can save to pdf with comment.

Can aspose handle the case ?

Hi Chris,

In Aspose.Words, you could use BuiltInDocumentProperties.Version property to get the version number of the application that created the document. If you find that the document was created using MS Word 2003, you can remove comments before rendering to PDF. Please see following code for example:

if (ms word 2003)
{
    doc.GetChildNodes(NodeType.Comment, true).Clear(); 
}

But this will not be able to reliably detect pre-2003 versions in all cases. As a workaround, please use the following code:

if (doc.BuiltInDocumentProperties.Version < 11)
{
    // 11 is for MS Word 2003, so everything below is pre2003
}

When a document was created by Microsoft Word, then high 16 bits of this property represent the major version and low 16 bit represent the build number.

Hope, this helps.

Best regards,

I cannot keep the comment that the word is from version 2003 when rendering the PDF ?

Hi Chris,

Thanks for your inquiry. Aspose.Words gives you an option whether to keep comments in PDF or not. If you don’t want to see comments in PDF, just execute the following line of code:

doc.GetChildNodes(NodeType.Comment, true).Clear(); 

Best regards,

Thanks for your help, i know that

doc.GetChildNodes(NodeType.Comment, true).Clear();

It can clear the comment. But i want to keep the comment.

My Issue is, when the Word document is from office 2003, i convert to PDF, the comment will disappear.

Those .doc is create from word 2003, not created from word 2007.

So that i cannot get the child node because Word 2003 is not using open xml

Any other option i can work on it ?

Hi Chris,

Thanks for your inquiry. Could you please attach your input Word document and output PDF file showing the undesired behavior here for testing? We will investigate the issue on our end and provide you more information.

Best regards,

Please find the attachment

This is the word file from Word 2003.
And the output pdf

Hi Chris,

Thanks for your inquiry. These are not actually comments. These are Revisions (tracked change) instead. We have logged this issue in our bug tracking system. The ID of this issue is WORDSNET-13339. Your thread has also been linked to this issue and you will be notified as soon as it is resolved. Sorry for the inconvenience.

Best regards,

The issues you have found earlier (filed as WORDSNET-13339) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Thanks for your work.
I have tested the conversion with Aspose.Word 16.7 for .net.
I found that the formatted information of track change is missing.

Attached is the input and output file.

Hi,

Please use the following code:

Document doc = new Document(filePath);
doc.LayoutOptions.RevisionOptions.ShowRevisionBalloons = true;
doc.Save(MyDir + @"16.7.0.pdf");

Hope, this helps.

Best regards,

Thanks for reply.
The code is work.
But I have another page.
While converting word to PDF, the output PDF was added an extra blank page.

Hi,

Thanks for your inquiry.

While using the latest version of Aspose.Words i.e. 16.7.0, we managed to reproduce this issue on our end. We have logged this issue in our bug tracking system. The ID of this issue is WORDSNET-14141. Your request has also been linked to the appropriate issue and you will be notified as soon as it is resolved. Sorry for the inconvenience.

Best regards,

Hi All,

I discover some track changes also miss and the size is different from the origianl one.

Please find the attachment

Hi,

Thanks for your inquiry. Could you please attach your input Word document, output PDF file and simple code here for testing? We will investigate the issue on our end and provide you more information.

Best regards,

Aspose.Words.Document doc = new Aspose.Words.Document("C:/Test/TestingMU.doc");
doc.LayoutOptions.RevisionOptions.ShowRevisionBalloons = true;
// doc.Save(MyDir + @"16.7.0.pdf");

doc.Save("C:/Test/" + "Document.Doc2PdfSave Out.pdf");
// Convert the document to a different format and save to stream.
doc.LayoutOptions.RevisionOptions.ShowRevisionBalloons = false;
doc.Save("C:/Test/" + "Document.Doc2PdfSave Out2.pdf");

Hi,

Thanks for your inquiry. We are working over your query and will get back to you soon.

Best regards,

Hi,

We have logged this issue in our bug tracking system. The ID of this issue is WORDSNET-14219. Your thread has also been linked to the appropriate issue and you will be notified as soon as it is resolved. Sorry for the inconvenience.

Best regards,