Failing to convert docx with images to sfdt using java backend

Hello,

We try to convert a docx document with images to a sfdt document using the java libraries in the backend part. 

The command line that show the error is this one:

String sfdtDocument = WordProcessorHelper.load(ai_sSourceFilePath, FormatType.Docx);

This is the error:

com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'd' (code 100) in prolog; expected '<'
at [row,col {unknown-source}]: [1,2]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:623)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2047)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
at com.syncfusion.javahelper.system.xml.XmlReaderSupport.read(XmlReaderSupport.java:364)
at com.syncfusion.docio.UtilityMethods.createReader(UtilityMethods.java:98)
at com.syncfusion.docio.UtilityMethods.createReader(UtilityMethods.java:110)
at com.syncfusion.docio.DocxParser.parseDrawing(DocxParser.java:20735)
at com.syncfusion.docio.DocxParser.parseRunValues(DocxParser.java:11740)
at com.syncfusion.docio.DocxParser.parseRun(DocxParser.java:12172)
at com.syncfusion.docio.DocxParser.parseParagraphItems(DocxParser.java:7301)
at com.syncfusion.docio.DocxParser.parseBody(DocxParser.java:6899)
at com.syncfusion.docio.DocxParser.parseDocument(DocxParser.java:6653)
at com.syncfusion.docio.DocxParser.parseDocument(DocxParser.java:1594)
at com.syncfusion.docio.DocxParser.read(DocxParser.java:1292)
at com.syncfusion.docio.DocxParser.read(DocxParser.java:941)
at com.syncfusion.docio.WordDocument.openDocx(WordDocument.java:3748)
at com.syncfusion.docio.WordDocument.openInternal(WordDocument.java:4143)
at com.syncfusion.docio.WordDocument.wordDocumentType(WordDocument.java:2993)
at com.syncfusion.docio.WordDocument.<init>(WordDocument.java:2914)
at com.syncfusion.ej2.wordprocessor.DocxImporting.convertWordToDocumentAdv(DocxImporting.java:77)
at com.syncfusion.ej2.wordprocessor.WordProcessorHelper.load(WordProcessorHelper.java:231)
at com.meta4.document.converter.M4DocumentConverter.Docx2Sfdt(M4DocumentConverter.java:55)
at com.meta4.test.documentconverter.TestM4DocumentConverter.testConvertDocx2Sfdt(TestM4DocumentConverter.java:16)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:542)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:770)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:464)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)


Thank you in advance for your response.

Regards.

David.


20 Replies 1 reply marked as answer

KB Kurthis Banu Abdul Majeeth Syncfusion Team July 7, 2021 05:18 AM UTC

Hi David, 

We suspect that the reported issue might be due to unsupported element in the Word document. So, could you please share us the below things at your end: 
1.       Input Word documents which used at your end. 
2.       Syncfusion product version which you are using in your application (front end and back end) 

This will be more helpful to reproduce the same issue at our end. Thereby, we will proceed further on the reported issue and provide you the appropriate solution at the earliest. 
  
Note: If you have any confidential data in your document, please replace with some dummy data and provide us the same. We just need your document to recreate the problem you face. 
  
Please let us know if you have any other questions. 

Regards, 
Kurthis Banu A. 



DM David Martinez July 7, 2021 07:46 AM UTC

Hi Kurthis,


Our Syncfusion product versions are:

  • ej2-vue-base: 19.1.63
  • ej2-vue-documenteditor: 19.1.69
  • syncfusion-docio-19.1.0.63.jar
  • syncfusion-ej2-wordprocessor-19.1.0.63
  • syncfusion-javahelper-19.1.0.63.jar

I attached too a docx with an image to reproduce the issue.

Regards.

David.


Attachment: doc_with_image_8414c3b6.zip


KB Kurthis Banu Abdul Majeeth Syncfusion Team July 8, 2021 09:38 AM UTC

 Hi David,  

We are cross checked your reported issue in latest version 19.2.0.44. We couldn’t reproduce the reported issue. 

So, kindly upgrade the latest jar files version (v 19.2.0.44) for both server and client side to resolve your reported issue. 

Client side:  
     
Server side: 
 
Please let us know if you are still facing issue.  
 
Regards, 
Kurthis Banu A. 



DM David Martinez July 8, 2021 02:22 PM UTC

Hi Kurthis,


I think I have seen the problem. If I create a test with only the JARs to transform a Docx to SFDT it works fine.


The problem is when we include this code in our application that has references to other third-party JARs. In this case adding the "woodstox-core-6.2.6.jar" with the dependency to "stax2-api-4.2.1.jar" then we reproduce the problem.


Could you tell us that this incompatibility exists and if there is some way to make it work without having to lose this? Today we use these other JARs for other functionalities in our application.


Regards,

David.



KB Kurthis Banu Abdul Majeeth Syncfusion Team July 9, 2021 08:26 AM UTC

 Hi David,   

We are tried to reproduce the reported issue with adding the "woodstox-core-6.2.6.jar" with the dependency to "stax2-api-4.2.1.jar". We couldn’t reproduce your reported issue in our end. 

Kindly check the below video link for your reference. 

Regards, 
Kurthis Banu A. 



DM David Martinez July 9, 2021 04:20 PM UTC

Hi Kurthis,


I have seen the video and I don't know if we do the same.


I have a java project to test the docx to sfdt conversion and it works fine when I only include syncfusion JARs. The problem occurs if I add the two that I told you then I see the conversion error. From what it seems from the syncfusion libraries you are calling classes that are in these other libraries and a conflict occurs. Perhaps you use other versions or have reused these classes but the fact is that if they are in the path the error occurs.


I am attaching a screenshot with my java project and the error.


Seeing the error stack when your class "com.syncfusion.javahelper.system.xml.XmlReaderSupport" is executed is when the third-party library class "woodstox-core-6.2.6.jar" is called which ends up giving the error: "com.ctc.wstx.sr.BasicStreamReader".


Could this be a problem with the version of this third-party component "woodstox-core-6.2.6.jar"? Do you use this internally? Why does loading this component impact syncfusion's?


Regards,

David.


Attachment: screenshot_fdf3efe3.zip


SM Suriya Murugan Syncfusion Team July 12, 2021 10:30 AM UTC

Hi David, 

Currently, we are checking the reported case. We will update further details by July 13,2021. 

Regards, 
Suriya M. 



KB Kurthis Banu Abdul Majeeth Syncfusion Team July 13, 2021 05:23 PM UTC

Hi David,  

Currently, we are checking your reported scenario. We will update further details by July 14,2021. 

Regards, 
Kurthis Banu A. 



KB Kurthis Banu Abdul Majeeth Syncfusion Team July 14, 2021 01:58 PM UTC

Hi David,   

We tried to reproduce the reported issue. We couldn’t reproduce the reported issue. 

For your reference, we have attached the Sample which we used to reproduce the reported issue and it can be downloaded from the below link.    

Sample Link: 

If you are facing any issues, kindly modify the above sample and share us same. Otherwise, Kindly share us simple sample to reproduce the reported problem our end. 

 This will be more helpful to reproduce the same issue at our end. Thereby, we will proceed further on the reported issue and provide you the appropriate solution at the earliest. 

Regards, 
Kurthis Banu A. 



KB Kurthis Banu Abdul Majeeth Syncfusion Team July 15, 2021 01:22 PM UTC

Hi David, 


Sorry for the inconvenience caused. 


We can reproduce the reported issue. We have confirmed that the mentioned “XML stream Exception occurs while opening Word document” is issue and we have logged a defect report. Fix will be included in our upcoming patch release which is tentatively scheduled on July 27, 2021. Once included, will update you.    
      

You can track the status from the below feedback.     



Regards, 
Kurthis Banu A. 



DM David Martinez July 15, 2021 02:37 PM UTC

Hi Kurthis,


Thank you very much for your help.


Tell you that seeing that the problem occurred with the factories provided in the java class "javax.xml.stream" and that they are being overwritten in this third-party Jar "woodstox-core.jar" causing the problem, we have managed to avoid it by including this before execute the conversion from java of the Docx to SFDT:


Properties props = System.getProperties();

props.setProperty ("javax.xml.stream.XMLInputFactory", "com.sun.xml.internal.stream.XMLInputFactoryImpl");

props.setProperty ("javax.xml.stream.XMLEventFactory", "com.sun.xml.internal.stream.events.XMLEventFactoryImpl");

props.setProperty ("javax.xml.stream.XMLOutputFactory", "com.sun.xml.internal.stream.XMLOutputFactoryImpl");


With this workaround it seems that the conversion works, perhaps it will help you when solving the problem.


Regards.

David.



KB Kurthis Banu Abdul Majeeth Syncfusion Team July 15, 2021 02:40 PM UTC

Hi David, 

Thanks for your update. We will check and resolve your reported issue. Fix will be included in our upcoming patch release which is tentatively scheduled on July 27, 2021. Once included, will update you.     
       
You can track the status from the below feedback.      

Regards, 
Kurthis Banu A. 



KB Kurthis Banu Abdul Majeeth Syncfusion Team July 27, 2021 12:40 PM UTC

Hi David,  

Thank you for your patience.

We have fixed the reported “XML stream Exception occurs while opening Word document” issue and we have generated patch for this fix in v19.2.0.44.  


How to use above patch:
1. Remove existing syncfusion.javahelper jar in your project.
2. Refer the above patch jar
3. Run the application.

 

The status of this bug report can be tracked through the below link:
https://www.syncfusion.com/feedback/26936/xml-stream-exception-occurs-while-opening-a-word-document 

This fix will be included in our 2021 Volume 2 SP release which is expected to be available at the mid of August 2021, tentatively.

Please let us know if you have any other questions. 

Regards, 
Kurthis Banu A. 


Marked as answer

DM David Martinez August 2, 2021 07:24 AM UTC

Hi Kurthis,


I have tried this new component and it worked without problems.


Thank you very much for your help.


Regards,

David.



KB Kurthis Banu Abdul Majeeth Syncfusion Team August 2, 2021 09:40 AM UTC

Hi David,   

Thanks for your update. 

Regards, 
Kurthis Banu A. 



DM David Martinez September 30, 2021 12:15 PM UTC

Hi Kurthis,

We have reviewed with the new version 19.3.0.43 and the same problem appears again.

Could you check if this change was included in this new version?

In the last 19.2.0.55 the problem was solved.

Thanks in advance for your response.

Regards,

David.




KB Kurthis Banu Abdul Majeeth Syncfusion Team October 1, 2021 02:58 PM UTC

Hi David,  

We deeply regret the inconvenience caused.   

We have confirmed that reported issue has been reproduced and it occurs only in latest released jar (19.3.0.43). It will be resolved on publishing Jar in next weekly release which scheduled on October 5th, 2021. 

Regards,    
Kurthis Banu A.  



KB Kurthis Banu Abdul Majeeth Syncfusion Team October 5, 2021 12:25 PM UTC

Hi David,  

We are glad to announce that our patch release (v19.3.44 ) is rolled out successfully and In that release, we have added the fix for reported issues.           

    
Please upgrade the package to latest version to resolve this issue.           

Regards,  
Kurthis Banu A.  



DM David Martinez October 5, 2021 12:49 PM UTC

Hi Kurthis,


Thanks a lot for the information.


We will use this new version.


Regards,

David.




KB Kurthis Banu Abdul Majeeth Syncfusion Team October 6, 2021 04:18 AM UTC

Hi David,   

Thanks for the update. 

Please upgrade the package to latest version (19.3.44) to resolve this issue.            

Regards,   
Kurthis Banu A.   


Loader.
Up arrow icon