oxygenxml / dita-ot-diagrams-plugin

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

Mermaid Diagram Renders as Raster Image Instead of Expected SVG in PDF Output #11

Closed SmartLayer closed 1 year ago

SmartLayer commented 1 year ago

I have encountered an issue where the Mermaid diagram is rendered as a raster image instead of the expected SVG format in the PDF output. This is inconsistent with the documentation in the README, which states that the diagram should be in SVG format.

Steps to Reproduce:

  1. Clone the repository from https://github.com/TokenScript/documents/
  2. Checkout commit 42ed9788826c38f38ff83af486fbff9b39b059f8
  3. Navigate to the src directory
  4. Generate a PDF using the following command:
    dita -i smartlayer-overview.ditamap -f pdf -o output

    Expected Result:

The generated PDF (output/smartlayer-overview.pdf) should contain the Mermaid diagram in SVG format.

Actual Result:

The generated PDF contains the Mermaid diagram in raster image format. image

It's worth noting that this issue is less severe than issue #10, as a diagram is produced in this case, albeit in an incorrect format. Any assistance in resolving this discrepancy would be greatly appreciated.

raducoravu commented 1 year ago

@weiwu-zhang at some point I took the decision to embed the diagram as a binary image for the PDF output: https://github.com/oxygenxml/dita-ot-diagrams-plugin/commit/355f3b9a49bd6aa29fe433521e0d5da9138c8053 I'm afraid I forgot the reason for this change I made, I think it was because the generated SVG file in certain cases was not supported by the PDF engine so I decided to produce a binary image instead.

If you want you can try to revert the changes in the "pdfSVG.xsl" and generate it again as an SVG. I just updated the readme to state that for mermaid images, the binary image is stored inside the PDF instead of the SVG.