We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Charts in document result in a (mistaken) FileCorruptedException

Hi

I’m producing docx files containing charts, and then attempting to convert these to pdf with the latest Aspose.Words (Aspose.Words.jdk16.jar),

I get the following exception:
com.aspose.words.FileCorruptedException: The document appears to be corrupted and cannot be loaded

Removing the charts from the document allows conversion to work correctly. I’ve attached a sample of a file that will not convert with charts.

Thanks
Phil Piper

Hi Phil,

Thanks for your inquiry.

While using the latest version of Aspose.Words i.e. 11.8.0, I managed to reproduce this exception on my side. I have logged this issue in our bug tracking system. The issue ID is WORDSNET-7063. Your request has 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-7063) have been fixed in this .NET update and this Java update.


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

Hi

No sign of any improvement, I’m afraid. I still see the same error when attempting to convert the attached docx document. Again, removing the charts from the document fixes the error.

Phil Piper

Hi Phil,

Thanks for your inquiry.

Could you please also double check if you are using the latest version of Aspose.Words i.e. 11.10.0? You can dynamically check if you’re referencing the correct DLL by using the following code snippet:

System.Reflection.Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (System.Reflection.Assembly assembly in assemblies)
{
    System.Reflection.AssemblyName assemblyName = assembly.GetName();
    if (assemblyName.Name.Contains("Aspose.Words"))
        Console.WriteLine("Aspose.Words Version Number: " + assemblyName.Version.ToString());
}

Best regards,

Hi

I’m using the Java version. How do I check the version number in that case?

Thanks
Phil

Hi Phil,

Thanks for your inquiry. You can determine Aspose.Words’ JAR version by unziping ‘Aspose.Words.jdk16.jar’ file. Please navigate to ‘META-INF’ folder and then open ‘MANIFEST.MF’ with Notepad. There you’ll find something like below:

Manifest-Version: 1.0
Specification-Title: Aspose.Words for Java
Specification-Version: 11.10.0.0
Specification-Vendor: Aspose Pty Ltd
Implementation-Title: Aspose.Words for Java
Implementation-Version: 11.10.0.0
Implementation-Vendor: Aspose Pty Ltd
Release-Date: 2012.06.30

Please let me know if I can be of any further assistance.

Best regards,

The problem is very much not fixed in Java version 11.10.0.0

Still seeing the following error when I attempt conversion from docx to pdf:

Fatal error: Uncaught [[o:Exception]:"java.lang.Exception: Invoke
 failed: [[o:ConvertDocXToPDF]]->convert((o:String)[o:String],
 (o:String)[o:String]). Cause: com.aspose.words.FileCorruptedException:
 The document appears to be corrupted and cannot be loaded. VM:
 1.7.0_07@<http://java.oracle.com/>" at:
 #-15 com.aspose.words.FileFormatUtil.Z(Unknown Source)
 #-14 com.aspose.words.Document.Z(Unknown Source)
 #-13 com.aspose.words.Document.Ã(Unknown Source)
 #-12 com.aspose.words.Document.(Unknown Source)
 #-11 com.aspose.words.Document.(Unknown Source)
 #-10 ConvertDocXToPDF.convert(ConvertDocXToPDF.java:12)
 #-9 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 #-8 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 #-7 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 #-6 java.lang.reflect.Method.invoke(Method.java:601)
 #-5 php.java.bridge.JavaBridge.Invoke(JavaBridge.java:1044)
 #-4 php.java.bridge.Request.handleRequest(Request.java:417)
 #-3 php.ja in <http://localhost:8080/JavaBridgeTemplate621/java/Java.inc> on line 195

Hi Phil,

Thanks for your inquiry. I rendered your documents (test.docx) you attached here and here with the latest version of ‘Aspose.Words for Java’ on my side and was unable to reproduce this exception on my side. I have attached a sample Pdf document here for your reference as well. Could you please also share your code here for testing? I will investigate the issue further on my side and provide you more information.

Best regards,

Hi

That output looks great.

I’m using the PHP/Java Bridge thing (running on Tomcat) to initiate the conversion from a PHP script (running under Apache 2). I’ve attached my PHP script along with the Java code I’m using (I had to add a .txt extension to upload).

Thanks
Phil

Hi Phil,

Thanks for the additional information. Does this happen with one document in particular or all Word Documents you try throw the exception during rendering to Pdf? It would be great if please produce a Pdf document on your side and attach it here for our reference as well. Also, please tell us the details of the machine environment you’re getting this problem on e.g. the operating system, the JDK version etc.

Best regards,

Hi again

I get the error whenever I have a chart embedded in the Word document that I’m trying to convert. If I use the same document saved with the chart (or charts) stripped out, the conversion works fine.

I’ve attached the PDF that results from a conversion of a Word document (without charts), although that’s probably not much use to you!

I can successfully convert a document with a chart that I created manually in Word 2010. The errors seem to occur whenever I attempt to convert a chart when the document has been created in PHP code using OOXML.

Phil

Some details of our environment:

PHP 5.3.6
Apache 2.2.20
Server version: Apache Tomcat/7.0.32
OS Name: Linux
OS Version: 3.0.0-26-server
Architecture: amd64
JVM Version: 1.7.0_07-b10
JVM Vendor: Oracle Corporation

Hope that helps!
Phil

Hi Phil,

Thanks for the additional information.

The PDF you attached in your post seems to be generated with Aspose.Words for Java v11.8.0. I would suggest you please upgrade to latest version from the following link:

https://downloads.aspose.com/words/java

Secondly, to check if the PDF is generated by Aspose.Words, please do the following:

  1. Open the PDF document with Adobe Acrobat
  2. Click on the ‘File’ menu and choose ‘Properties’ to open ‘Document Properties’ dialogue box.
  3. In the ‘Decsription’ tab, under ‘Advanced’ section, you’ll see ‘Pdf Producer’ name.

Moreover, I have attached a screenshot highlighting the PDF Producer version information here for your reference.

If we can help you with anything else, please feel free to ask.

Best regards,

Thanks. Looks like I was indeed using an older version. Charts seem to be converting reliably now.

Hi Phil,

Thanks for your feedback. Please let us know any time you have any further queries. We’re always glad to help you.

Best regards,