‎11-06-2020 12:24 PM
Hi community,
We are facing the error below when we try to save diagrams in image format using the java API :
Exception in thread "main" MEGA Error 0x80040a00
at com.mega.modeling.api.jni.MegaDrawingJNI.SaveAsPicture(Native Method)
at com.mega.modeling.api.jni.MegaDrawingProxy.saveAsPicture(Unknown Source)
at carto.intra.com.Cartoextract.ExtractDataDiag(Cartoextract.java:768)
at carto.intra.com.Cartoextract.ExtractDataOfApp(Cartoextract.java:187)
at carto.intra.com.Cartoextract.main(Cartoextract.java:90)
Here is the java code we use :
diagram=(MegaObject)colDiagIter.next();
//Récupération des propriétés de daigramme
DiagName=diagram.getProp("Name");
//Récupération du dessin
md=(MegaDrawing)MegaServiceBuilder.getDrawingOf(diagram);
height=md.getDrawingBoundHeight()*2;
withd=md.getDrawingBoundWidth()*2;
//sauvegarde des cartos dans les repertoires sous format jpeg
md.saveAsPicture(RepStockage+"//"+DiagName+".jpg",1, 24, 100, 96,height, withd);
Best Regards
Asmaa
Solved! Go to Solution.
‎16-06-2020 03:29 PM
Hi community,
We resolved the problem. For information in case you face the same issue. The exception GDI+ was caused by 2 reasons :
DiagName=sansAccent(diagram.getProp("Name")).replaceAll("[^\\p{Alpha}\\p{Digit}]+","_")
md=(MegaDrawing)MegaServiceBuilder.getDrawingOf(diagram);
height=md.getPageHeight()*(md.getNumberOfVerticalPages()+1);
withd=md.getPageWidth()*(md.getNumberOfHorizontalPages()+1);
Best Regards,
Asmaa
‎11-06-2020 02:38 PM
Hi Jerome,
OK. we will try to change parameters.
Thank you.
Asmaa
‎11-06-2020 02:34 PM
GDIplus is a windows library used by HOPEX
Error looks related to this library
General recommendations