 |
Creating a png image using PlantUML and Java API
Source code name: "uml_diagram1_png.py"
Programming language: Python
Topic: Plots/Diagrams
DMelt Version 2.2. Last modified: 02/13/1972. License: Pro
https://datamelt.org/code/cache/uml_diagram1_png_2235.py
To run this script using the DMelt IDE,
copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.
from net.sourceforge.plantuml import SourceStringReader
from java.io import ByteArrayOutputStream
from net.sourceforge.plantuml import FileFormatOption,FileFormat
from java.lang import String
from java.io import FileOutputStream
source = """
@startuml
scale 600*400
[AA] <>
[BB] <>
[CC] <>
node node1
node node2 <>
database Production
skinparam component {
backgroundColor<> DarkKhaki
backgroundColor<> Green
}
skinparam node {
borderColor Green
backgroundColor Yellow
backgroundColor<> Magenta
}
skinparam databaseBackgroundColor Aqua
@enduml
"""
s=SourceStringReader(source)
file =FileOutputStream("diagram.png")
s.generateImage(file);
print "diagram.png created"
file.close()
You see the box below because you did not login.