Allow ditaa png export even when svg is selected

0 votes
asked Feb 1, 2013 in Wanted features by Andreas.Pokorny (140 points)
I am using plantuml to create a docbook document including some uml diagrams. I do prefer svg output since the pdf end result is scaleabe and searchable. But then I cannot use ditaa within the document. Therefore I created a patch to ignore the output setting and just enforce png for ditaa .. I would have attached the patch here but I cannot find an option for it...

 

.. so I will just add it inline:

 

--- plantuml-7950/src/net/sourceforge/plantuml/ditaa/PSystemDitaa.java  2012-07-30 12:59:57.000000000 +0200
+++ plantuml-7950-patched/src/net/sourceforge/plantuml/ditaa/PSystemDitaa.java  2013-01-30 11:37:02.000000000 +0100
@@ -67,8 +67,8 @@
 
        public void exportDiagram(OutputStream os, CMapData cmap, int index, FileFormatOption fileFormatOption)
                        throws IOException {
-
-               if (fileFormatOption.getFileFormat() == FileFormat.PNG) {
+                // ditaa can only export png so file format is mostly ignored
+               if (fileFormatOption.getFileFormat() != FileFormat.ATXT) {
                        final ConversionOptions options = new ConversionOptions();
                        options.setDropShadows(dropShadows);
                        final Diagram diagram = new Diagram(grid, options, processingOptions);
@@ -77,9 +77,6 @@
                        ImageIO.write(image, "png", os);
                } else if (fileFormatOption.getFileFormat() == FileFormat.ATXT) {
                        os.write(getSource().getPlainString().getBytes());
-               } else {
-                       throw new UnsupportedOperationException(fileFormatOption.getFileFormat().toString());
                }
-
        }
 }

1 Answer

0 votes
answered Feb 1, 2013 by plantuml (223,540 points)
Hello,

Ok, this will be added in next release.

Thanks for the patch,
...