Call to "new Diagram()" results in exception

Please find attached a ZIP file that contains our sample Java source to convert a .vdx to .vsdm.
The ZIP also contains the sample .vdx file to be converted.

An exception is thrown during the execution of “new Diagram()” :
com.aspose.diagram.DiagramException: Error in element Pages in \VisioDocument. loadPages

The “Pages” element does not have any attributes, so it is not clear why there is an “error in element Pages”.
The “Pages” element in the .vdx file has one child “Page” element inside it, and it conforms to the definition.
Different versions of Visio can open this .vdx with no errors.

Our sample Java .vdx to .vsdm conversion program can convert other .vdx files - maybe the “new Diagram()” fails because the .vdx is very large?

mt-plc-subs.zip (635.8 KB)

Hi,

Thank you for contacting support. We managed to replicate the error while loading a VDX drawing into the Aspose.Diagram for Java API. It has been logged under the ticket ID DIAGRAMJAVA-50506 in our bug tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates. We are sorry for the inconvenience caused.

Hi,

Thank you for being patient. The ticket ID DIAGRAMJAVA-50506 has been resolved. If there is no issue in the quality assurance phase, then this fix will be included in the next version 17.7 of Aspose.Diagram for Java API. We will notify you as soon as the new release is published.

@caldercay,
Thank you for being patient. In reference to the ticket ID DIAGRAMJAVA-50506, please download and try the latest Hotfix version 17.6.1 of Aspose.Diagram for Java API (download link: Aspose.Diagram for Java 17.6.1) and let us know how that goes on your side.

Best Regards,
Imran Rafique

Thank you for the 17.6.1 HotFix release.

We have tested this HotFix - the original exception is not thrown during the execution of “new Diagram()” for the large VDX input file, so that is good news.

However, when we call diagram.save( newFilename, SaveFileFormat.VSDM ) to save as a VSDM type, there is only 6 shapes in the VSDM file - there are many in the “source” VDX file. We also know the conversion from VDX to VSDM is incomplete because of file sizes:
VDX = 8,875 kb
VSDM = 581 kb
… so I will have to add a new ticket that all shapes are not saved to new format.

@caldercay,
Please highlight the problem of missing shapes with the help of a snapshot. We can find layout issues in the source VDX and Aspose.Diagram API is generating the output VSDM drawing with less layout issues. Please refer to the output VSDM drawing: OutputVSDMJava17.6.1.zip (1.0 MB)

Best Regards,
Imran Rafique

unfortunately, i can not download your attached file “OutputVSDMJava17.6.1.zip”

I see this error when i click on it:
“Sorry, this file is private. Only visible to post creator and staff members.”

As you requested, I have attached a ZIP file that contains some screenshots of the source VDX file opened with Visio 2016

many-shaps-vdx.zip (116.5 KB)

@caldercay,

The view of Visio drawing (in your environment) is different than the view in our installed Microsoft Visio applications, kindly share the version and edition of your Microsoft Visio 2016 application.

Please refer to this download link: OutputVSDMJava17.6.1.zip

Best Regards,
Imran Rafique

Visio information:
Microsoft Visio Standard 2016 MSO (16.0.4266.1001) 32-bit
.
I am able to download your VSDM file - thank you. It is interesting the file size differences:
9,087,792 mt-plc-subs.vdx <== source VDX
594,073 mt-plc-subs.vsdm <== when we run our conversion program
1,072,095 OutputJava17-6-1.vsdm <== Aspose dev team

This is our code to convert

package convert;
import com.aspose.diagram.Diagram;
import com.aspose.diagram.LoadFileFormat;
import com.aspose.diagram.LoadOptions;
import com.aspose.diagram.SaveFileFormat;

public class ConvertVisio {
static String basename = “c:\dumps\mt-plc-subs” ;

public static void main(String[] args) throws Exception  {
	 vdxToVsdm( ) ;
}

public static void vdxToVsdm( ) {
	String fileToConvert = basename + ".vdx";
	String newFilename   = basename + ".vsdm";

	LoadOptions loadOptions = new LoadOptions( LoadFileFormat.VDX );
	Diagram diagram = null;
	try {
		System.out.println( "Importing: " + fileToConvert );
		diagram = new Diagram( fileToConvert, loadOptions );
	} 
	catch (Exception e1)  {
		e1.printStackTrace();
	}

	if( diagram != null )  {
		System.out.println( "Saving as vsdm: " + newFilename );
		try {
			diagram.save( newFilename, SaveFileFormat.VSDM );
			System.out.println( "Saved as: " + newFilename );
		} 
		catch (Exception e)  {
			e.printStackTrace();
		}
	}
}

}

@caldercay,
Thank you for the details. We are still unable to see layout of shapes as per your snapshots and we need to replicate to the same problem in our environment. Kindly send details as below:

  1. What is the Operating System name and edition, e.g. Windows 7 Ultimate 32 bit?
  2. What is the JDK version (including sub-update)?
  3. What is the IDE name and edition in which you are running this code snippet?
  4. What are the local language settings?
  5. Any other handy information which can help us to replicate the problem in our environment.

Please also send your output VSDM. Your response is awaited.

Best Regards,
Imran Rafique

1.a. Development machine - Win7 Pro SP1, 64-bit
1.b. Visio machine - Win7 Enterprise SP1, 32-bit
2. JDK 1.8.0 build 121, 64-bit; Compiler-compliance level: 1.8
3. Eclipse Oxygen 4.7.0, Build id: 20170620-1800
4. Locale: en_US
Compiles: no errors, no warnings.
Same output results (.vsdm) if a Run in Eclipse or run java from command line.
Source .vdx and resulting .vsdm in attached ZIP file.

vdx-converted-vsdm.zip (1.2 MB)

@caldercay,

Kindly choose one Operating System in which you took snapshots of the source VDX. Without using Aspose.Diagram API, we must be able to view the same layout of source VDX as we can view in your snapshots.

Best Regards,
Imran Rafique

The issues you have found earlier (filed as DIAGRAMJAVA-50506) have been fixed in Aspose.Diagram for Java 17.7. This message was posted using BugNotificationTool from Downloads module by imran.rafique

The source VDX is generated by our software that runs on Tomcat 8 / Java 1.8.
The source VDX was generated on my Dev machine, which is Win7 Pro SP1, 64-bit.

I only used Visio to open the VDX (read-only) to take some screenshots.
I did not alter the VDX file when i opened it in Visio.

@caldercay,
We will create a Visio machine (Win7 Enterprise SP1, 32-bit) to view the drawing in the same way as per your snapshots. We are preparing the required environment and will get back to you soon at the end of this week or early next week. Please spare us a little time.

Best Regards,
Imran Rafique

This is where I downloaded the free Microsoft VirtualBox virtual machine for Win7 Enterprise SP1, 32-bit (IE10 on Win7 choice on dropdown at URL below)

https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/

@caldercay,
Thanks to share the download link. We are downloading this VM and it will take some time. We will get back to you once we are done with our initial investigation.

Best Regards,
Imran Rafique

Do you have any feedback to share ?

@caldercay,
Thank you for the inquiry and sorry for the delay. We are unable to replicate the same view of VDX in the downloaded virtual machine. However, please spare us a bit more time and we will get back to you in a couple of days.

Best Regards,
Imran Rafique

Any update to share with us?