oxygenxml / dita-ot-diagrams-plugin

Dynamically convert PlantUML content inside DITA topics to SVG
Apache License 2.0
9 stars 3 forks source link

Support `scale` command of PlantUML #1

Closed svenihoney closed 4 years ago

svenihoney commented 4 years ago

To scale the output grpahics, PlantUML support the scale command (see https://plantuml.com/de/commons). If I add the scale command to embedded PlantUML code, the image is obvoiusly scaled, but invisible.

How to reproduce: Insert the line scale 0.9 into com.oxygenxml.plantuml.svg/samples/testDiagram.dita at line 8, and run it with the pdf2 transformation. Without the line, the image is displayed correctly, with the line, no image is visible (blank space with the size of the image).

Tested with DITA-OT 3.3.4.

raducoravu commented 4 years ago

I run the transformation using the same DITA OT 3.3.4 and the installed plugin, on my side the PDF contains the properly scaled SVG image. As a PDF processor I'm using the default Apache FOP engine bundled with DITA OT 3.3.4.

So my steps were:

1) Download DITA OT 3.3.4: https://github.com/dita-ot/dita-ot/releases/tag/3.3.4 2) Add the plugin "com.oxygenxml.plantuml.svg" to the plugins folder, run "dita --install" to install it. 3) In the console view run:

 dita -i D:\path\to\samples\sample.ditamap -f pdf2 -v

The generated PDF contained a scaled down version of the image, I also tested with scale 0.5:

        <foreign outputclass="embed-plant-uml">@startuml
            scale 0.5
            Alice -> Bob: Authentication Request
            Bob --> Alice: Authentication Response

            Alice -> Bob: Another authentication Request
            Alice &lt;-- Bob: Another authentication Response
                @enduml</foreign>

and I got in the PDF the smaller equivalent image.

svenihoney commented 4 years ago

Okay, after your comment I tried to find out the differences: With JRE 8 it does not work, with JRE 11 and JRE 13 it works correctly. Perhaps a not about it would be helpful?

raducoravu commented 4 years ago

I don't know, the test I mentioned above was with "jdk1.8.0_102" on Windows 10 and it worked for me.

svenihoney commented 4 years ago

Hm, I am on Arch Linux, jre8-openjdk 8.u242-1...

raducoravu commented 4 years ago

I'm using Oracle Java 1.8. The problem is probably not in the plugin itself which just creates SVG but in how the SVG is interpreted by the Apache FOP processor (using the Apache Batik libraries), but not sure how the used Java version affects this.

svenihoney commented 4 years ago

At least this may be of help for people with the same problem, thanks!

raducoravu commented 4 years ago

Thanks for posting the issue, I'm happy the plugin might prove useful to you. We have the discussion on this closed issue, if somebody else encounters similar problems we can update the Readme.