Error converting .VSD to PDF

ES.20000 - 02 - Actuaciones Previstas sin nuevas UUFF.vsd.zip (149.5 KB)

When trying to convert the file ES.20000 - 02 - Actuaciones Previstas sin nuevas UUFF.vsd to PDF, an error occurs. Testing the conversion on your demo, the conversion is OK.

This is not a structured storage file. - at …ctor(BinaryReader )
at .(Stream )
at …ctor(String )
at …ctor(String )
at InvokeStub_…ctor(Object, Span`1)
at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
— End of stack trace from previous location —
at d.(Exception )
at d.(Object )
at d.( )
at d.e(d ,  )
at d.()
at d.(Boolean )
— End of stack trace from previous location —
at d.(Exception )
at d.(Object )
at d.()
at d.(Object , UInt32 )
at d.(Boolean )
at d.(Object[] , Type[] , Type[] , Object[] )
at d.(Int32 , Type[] , Type[] , Boolean )
at d.e(d ,  )
at d.()
at d.(Boolean )
— End of stack trace from previous location —
at d.(Exception )
at d.(Object )
at d.()
at d.(Object , UInt32 )
at d.(Boolean )
at d.(Object[] , Type[] , Type[] , Object[] )
at d.(Stream , String , Object[] , Type[] , Type[] , Object[] )
at d.(Stream , String , Object[] )
at d.(Stream , String , Object[] )
at e.(String )
at Aspose.Diagram.Diagram…ctor(String filename)
at ConverterLib.Converters.VisioConverter.Convert() in /src/ConverterLib/Converters/VisioConverter.cs:line 17
at SEPDFConverter.Service.ConverterService.Convert() in /src/SEPDFConverter/Service/ConverterService.cs:line 136

@everaldo

It seems you’re encountering an error while converting a .VSD file to PDF, but the conversion works fine on the demo. The error message indicates that the file might not be recognized as a structured storage file, which can happen if the file is corrupted or not in the expected format.

Here’s a step-by-step plan to troubleshoot and resolve the issue:

  1. Check File Integrity: Ensure that the .VSD file is not corrupted. Open it in Microsoft Visio to verify that it opens without issues.

  2. Use the Latest Version: Confirm that you are using the latest version of the Aspose.Diagram library, as bugs are often fixed in newer releases.

  3. Load Options: When loading the diagram, use LoadOptions to specify the file format explicitly. This can help if the library is having trouble inferring the format.

    LoadOptions loadOptions = new LoadOptions();
    loadOptions.LoadFormat = LoadFormat.VSD; // Specify the format
    Diagram diagram = new Diagram("path_to_your_file.vsd", loadOptions);
    
  4. Save Options: When saving to PDF, ensure you are using the appropriate save options. You can specify options like page size or compression if needed.

    PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
    diagram.Save("output.pdf", pdfSaveOptions);
    
  5. Test with Different Files: If possible, try converting other .VSD files to determine if the issue is specific to this file or a general problem with your setup.

  6. Check for Dependencies: Ensure that all necessary dependencies for Aspose.Diagram are correctly installed and referenced in your project.

If you follow these steps and still encounter issues, please provide any additional error messages or details about your environment. I am here to assist you further. Let me know how it goes!

I changed the extension from .VSD to .VSDX and it worked fine.

@everaldo
Thanks for the template file.
The template file is a zip file not a vsd.
It is great that you were able to resolve this issue on your end. In case you have further inquiries or may need any help in future, please let us know by posting a new thread in Aspose.Diagram’ forum.
Thanks.