Welcome to PlantUML Q&A, where you can ask questions and receive answers from other members of the community.

You can also submit new features request and vote for them.

file extension when using @startuml filename

0 votes
Is there a way to automatically generate the file extension based on the output format?

I want to write

@startuml filename

and e.g. the parameter "-pdf" should lead to filename.pdf
while the parameter "-tpng" should lead to filename.png
asked Feb 10 in Wanted features by anonymous

2 Answers

0 votes


The "filename" of the file with the PalntUML code give the "filename".

If version.txt content is:

java -jar C:\PgmFiles\PlantUML\plantuml.jar -tpng version.txt 
generate version.png
java -jar C:\PgmFiles\PlantUML\plantuml.jar -tsvg version.txt
generate version.svg
answered Feb 10 by Serge Wenger Work (4,770 points)
0 votes
Good suggestion, thanks!

So we've built a new beta https://dl.dropboxusercontent.com/u/13064071/plantuml.jar

With this beta, if no file extension if given after the "@startuml filename", we add the corresponding one.

The only drawback to us is that it breaks somehow the compatibility. someone uses PlantUML today with "@startuml filename" without extension, he will have a slightly different result (because some extension will be added to the filename). However, since we do NOT append an extension if some is already present, we expected that this will impact very few people, because probably people are putting extension to filename.

Tell us if it's working for you!
answered Feb 10 by plantuml (125,210 points)
Support This Project Offer 250 Mo! Follow PlantUML on Twitter