We are comparing two documents that have svg images inserted into them using DocumentBuilder.insertImage. Those images are flagged as being different even though they are the same. Could you add an option to ignore those images or perhaps tell us why those images are flagged as being unequal?
To ensure a timely and accurate response, please attach the following resources here for testing:
- Your input Word document.
- Please attach the output Word file that shows the undesired behavior.
- Please attach the expected output Word file that shows the desired behavior.
- Please create a standalone console application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing.
As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.
PS: To attach these resources, please zip and upload them.
Here’s the code:
Document documentA = new Document(); DocumentBuilder builderA = new DocumentBuilder(documentA); builderA.insertImage("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><svg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'><path d='M80,67C47,121-25,60,10,22C5,89,70,80,80,67zM30,16C2,42,56,87,80,47C70,57,24,57,30,16M50,10C45,34,72,37,80,31C57,55,32,21,50,10z' fill='#4082ae'/></svg>".getBytes()); documentA.save("A.docx"); Document documentB = new Document(); DocumentBuilder builderB = new DocumentBuilder(documentB); builderB.insertImage("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><svg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'><path d='M80,67C47,121-25,60,10,22C5,89,70,80,80,67zM30,16C2,42,56,87,80,47C70,57,24,57,30,16M50,10C45,34,72,37,80,31C57,55,32,21,50,10z' fill='#4082ae'/></svg>".getBytes()); documentB.save("B.docx"); documentA.compare(documentB, "test user", new java.util.Date()); documentA.save("differences.docx");
The code creates document A and inserts an svg then goes on to create document B inserting the exact same svg. Afterwards both documents are compared and the document showing the differences is saved as differences.docx. In my view there should be no differences because the image is the exact same, but it shows the image as being different. If you copy and paste the inserted image by hand from document A into a document C and then compare the two documents, the documents are shown as being equal, so this seems to be an Aspose.Words related issue.
documents.zip (16.6 KB)
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-18867. 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-18867) have been fixed in this update.
A post was split to a new topic: Compare documents with images