Source:
<code>public static List<String> exportDiagram(Diagram diagram, File directory) throws IOException { int dpi = Application.getInstance().getEnvironmentOptions().getGeneralOptions().getImageResolutionDpi(); int scalePercent = 100; Project project = Application.getInstance().getProject(); if (project == null) { return Collections.emptyList(); } List<String> results = new ArrayList<>(); DiagramPresentationElement diagramPresentationElement = project.getDiagram(diagram); if (diagramPresentationElement == null) { return Collections.emptyList(); } <START> System.setProperty("svg.enriched.export", Boolean.toString(!diagramPresentationElement.getDiagramType().getRootType().equals(com.nomagic.magicdraw.uml.DiagramTypeConstants.DEPENDENCY_MATRIX))); <END> Application.getInstance().getGUILog().log("[INFO] Generating Diagram of type" + diagramPresentationElement.getDiagramType().getRootType() + "."); String pngFileName = diagramPresentationElement.getID() + ".png"; String svgFileName = diagramPresentationElement.getID() + ".svg"; File pngDiagramFile = new File(directory, pngFileName); File svgDiagramFile = new File(directory, svgFileName); results.add(directory.getName() + "/" + svgFileName); try { MDUtils.exportSVG(svgDiagramFile,diagramPresentationElement); ImageExporter.export(diagramPresentationElement, ImageExporter.PNG, pngDiagramFile, false, dpi, scalePercent); } catch (IOException | TransformerException e) { e.printStackTrace(); return results; } boolean scale = true; try (BufferedReader reader = new BufferedReader(new FileReader(svgDiagramFile))) { String line = reader.readLine(); while (line != null) { if (line.startsWith("<svg")) { int widthindex = line.indexOf("width"); if (widthindex > -1) { int end = line.indexOf("\"", widthindex + 7); String w = line.substring(widthindex + 7, end - 2); double wd = Double.parseDouble(w); if (wd < 5.5) { scale = false; } } break; } line = reader.readLine(); } } catch (NumberFormatException e) { e.printStackTrace(); } results.add(Boolean.toString(scale)); return results; }</code><technical_language>covered in MDUtils.exportSVG</technical_language>

Target:
public static List<String> exportDiagram(Diagram diagram, File directory) throws IOException { Project project = Application.getInstance().getProject(); if (project == null) { return Collections.emptyList(); } List<String> results = new ArrayList<>(); DiagramPresentationElement diagramPresentationElement = project.getDiagram(diagram); if (diagramPresentationElement == null) { return Collections.emptyList(); } String pngFileName = diagramPresentationElement.getID() + ".png"; String svgFileName = diagramPresentationElement.getID() + ".svg"; File pngDiagramFile = new File(directory, pngFileName); File svgDiagramFile = new File(directory, svgFileName); results.add(directory.getName() + "/" + svgFileName); try { MDUtils.exportSVG(svgDiagramFile, diagramPresentationElement); ImageExporter.export(diagramPresentationElement, ImageExporter.PNG, pngDiagramFile, false, DOCGEN_DIAGRAM_DPI, DOCGEN_DIAGRAM_SCALE_PERCENT); } catch (IOException | TransformerException e) { e.printStackTrace(); return results; } boolean scale = true; try (BufferedReader reader = new BufferedReader(new FileReader(svgDiagramFile))) { String line = reader.readLine(); while (line != null) { if (line.startsWith("<svg")) { int widthindex = line.indexOf("width"); if (widthindex > -1) { int end = line.indexOf("\"", widthindex + 7); String w = line.substring(widthindex + 7, end - 2); double wd = Double.parseDouble(w); if (wd < 5.5) { scale = false; } } break; } line = reader.readLine(); } } catch (NumberFormatException e) { e.printStackTrace(); } results.add(Boolean.toString(scale)); return results; }