Issue #21 resolved

Include PlantUML in pdf document shows images very large

Anonymous 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. 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.

  5. 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).

  6. Log in to comment