Free Support Forum - aspose.com

Unable to cast object of type ' ' to type ' '


#1

Hi

The attached visio file is throwing an Unable to cast object of type ' ’ to type '​ ’ while trying to convert it to SVG using the following snippet

var d = new Diagram(file);
var SVGso = new SVGSaveOptions();
SVGso.ExportGuideShapes = false;
SVGso.SaveFormat = SaveFileFormat.SVG;
SVGso.SVGFitToViewPort = true;
SVGso.ExportElementAsRectTag = true;
d.Save(svgoutname, SVGso);

We are also converting it to PDF, GIF and PNG, but either of these formats have been testet yet at our process halt when either of the 4 formats fails to convert.

PDF is just saved with

d.Save(pdfoutname, SaveFileFormat.PDF)

GIF and PNG are saved with (the format is changed for PNG output - ofcourse)

var so = new ImageSaveOptions(SaveFileFormat.GIF);
so.CompositingQuality = CompositingQuality.HighQuality;
so.InterpolationMode = InterpolationMode.HighQualityBicubic;
d.Save(outputname, so);

Using Apose.Diagrams 19.3.0

object cast exception.zip (327.4 KB)


#2

@hellagutmanndk

We have tested the scenario in our environment by converting your diagram into each of four formats and were able to replicate the mentioned exception in case of SVG. However, remaining formats (i.e. PDF, GIF, PNG) were generated without any issue or system halt. For your kind reference, attached are the outputs generated at our end.

Si_PCR_4~PCR_2.0_DV4TD_M_Vingecellepumpe.png (55.7 KB)
Si_PCR_4~PCR_2.0_DV4TD_M_Vingecellepumpe.gif (54.0 KB)
Pdf.pdf (617.6 KB)

For VSD to SVG Conversion issue, we have logged it as DIAGRAMNET-51632 in our issue tracking system for further investigation. We will surely let you know as soon as we have some updates regarding its resolution. Please be patient and spare us little time.

We are sorry for the inconvenience.


#3

that GIF is very dithered, can some adjustments be made by saveoptions? or is it a new task for you?


#4

@hellagutmanndk

We need to investigate this issue related to bad quality of output GIF. We have logged it under the ticket ID DIAGRAMNET-51633 in our issue tracking system. We will share further updates as soon as we have some regarding its resolution. Please spare us little time.

We are sorry for the inconvenience.


#5

The issues you have found earlier (filed as DIAGRAMNET-51632) have been fixed in Aspose.Diagram for .NET 19.4.