Issue #21 resolved

Include PlantUML in pdf document shows images very large

Anonymous avatarAnonymous created an issue

Few use case and actors can fill a whole page. The solution could be add a parameters to let the user specify a scale for the includegraphics latex command? Just a suggestion. Marco

Comments (13)

  1. Yuya Nishihara

    let the user specify a scale for the includegraphics

    Hmm, it might be nice if we can specify parameters like image directive.

    FWIW, plantuml_latex_output_format and PlantUML's skin parameter can change the rendering of PDF output.

    • plantuml_latex_output_format = 'pdf' generates PDF image instead of PNG (yet supported by release version)
    • plantuml = 'java -jar plantuml.jar -SdefaultFontSize=8' changes the default font size (for details, see
  2. Anonymous

    Yes image directive can be usefuill, however consider that actually image size is acceptable for html out but not for pdf, because of this I suggest a way to control the includegraphic statement. I'm already using pdf output. I gave a try also to defaultFontName but as result I got a graph almost the same size but with font very small compared with actor dimensions. BTW: sphinx with plantUML is the tool I have looked for along many years!!!

  3. Anonymous

    My 2 cents follows. This way you can use the directive :includegraphics: scale=1, width=... etc

    Best regard, Mar

    diff -r 14db1e6b4f01 plantuml/sphinxcontrib/
    --- a/plantuml/sphinxcontrib/	Fri Nov 25 08:54:30 2011 +0100
    +++ b/plantuml/sphinxcontrib/	Sat Dec 03 11:29:05 2011 +0100
    @@ -37,12 +37,17 @@
                Alice <- Bob: Hi
         has_content = True
    -    option_spec = {'alt': directives.unchanged}
    +    option_spec = {'alt': directives.unchanged, 'includegraphics': directives.unchanged}
         def run(self):
             node = plantuml()
             node['uml'] = '\n'.join(self.content)
             node['alt'] = self.options.get('alt', None)
    +        node['includegraphics'] = self.options.get('includegraphics', None)
    +        if node['includegraphics'] is None:
    +            node['includegraphics'] = ''
    +        else:
    +            node['includegraphics'] = '[' + node['includegraphics'] + ']'
             return [node]
     def generate_name(self, node, fileformat):
    @@ -198,7 +203,7 @@
         except PlantUmlError, err:
             raise nodes.SkipNode
    -    self.body.append('\n\\includegraphics{%s}\n' % self.encode(refname))
    +    self.body.append('\n\\includegraphics%s{%s}\n' % (node['includegraphics'], self.encode(refname)))
         raise nodes.SkipNode
     def pdf_visit_plantuml(self, node):
  4. Yuya Nishihara

    Which latex option is necessary? width= and height= ?

    I want to avoid bare :includegraphics: because no other sphinx extensions implement it in that way.

  5. prikhi

    width, height and/or scale would be awesome.

    bonus but completely unecessary would be to make it captioned like a figure and alignable.

    Thanks for the reply.

  6. prikhi

    Sorry for the immense delay, but the patch works great! I mostly use scale or just the width.

    What is the effect of using a unitless number? I was unable to percieve any difference with the values I chose (35 and 90).

  7. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.