hi,
I want to show the comment bar in pdf, used to display the doc compare result. But various configuration attempts can not achieve the effect I want . (version: Aspose.Words for Java 19.1)
My code is as follows:
sourceDoc.compare(targetDoc, "user", new Date(), options);
RevisionOptions revisionOptions = sourceDoc.getLayoutOptions().getRevisionOptions();
revisionOptions.setShowRevisionMarks(true);
revisionOptions.setShowReisionBars(true);
sourceDoc.save("result.pdf");
Attached with the results I want.
compare-doc.zip (237.3 KB)
@matt.wang
Please use RevisionOptions.ShowInBalloons property as shown below to get the desired output.
RevisionOptions revisionOptions = sourceDoc.getLayoutOptions().getRevisionOptions();
revisionOptions.setShowRevisionMarks(true);
revisionOptions.setShowInBalloons(ShowInBalloons.FORMAT_AND_DELETE);
sourceDoc.save("result.pdf");
1 Like
Works for me, thanks for your reply.
@matt.wang
Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.
@tahir.manzoor
hi,
I used two new files for comparison and output pdf. But running error.
java.lang.ClassCastException: com.aspose.words.HeaderFooter cannot be cast to com.aspose.words.Body
My code is as follows:
Document sourceDoc = new Document(sourceFileStream);
Document targetDoc = new Document(targetFileStream);
sourceDoc.compare(targetDoc, "user", new Date(), compareOptions);
RevisionOptions revisionOptions = sourceDoc.getLayoutOptions().getRevisionOptions();
revisionOptions.setShowRevisionMarks(true);
revisionOptions.setShowRevisionBars(true);
revisionOptions.setShowInBalloons(ShowInBalloons.FORMAT_AND_DELETE);
String uuid = UUID.randomUUID().toString();
String outputPath = baseDir + uuid + ".pdf";
sourceDoc.save(outputPath);
doc.zip (37.8 KB)
@matt.wang
We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-19967. You will be notified via this forum thread once this issue is resolved.
We apologize for your inconvenience.
The issues you have found earlier (filed as WORDSNET-19967) have been fixed in this Aspose.Words for .NET 20.3 update and this Aspose.Words for Java 20.3 update.