xwikisas / application-diagram

Create various types of diagrams using draw.io
GNU Lesser General Public License v2.1
0 stars 8 forks source link

Add support for choosing between SVG-based and image-based PDF export per diagram #102

Closed mflorea closed 4 years ago

mflorea commented 4 years ago

We recently dropped image-based PDF diagram export (when exporting a wiki page to PDF) in favor of SVG-based PDF export. While this has improved the PDF export quality in general, there are still some issues coming from the fact that we use Apache FOP for server-side PDF export which doesn't support HTML inside SVG (foreign objects) and the layout is not all the time 100% the same as what you see in the browser.

Image based PDF export on the other hand is not interactive (you can't click on the links for instance) and the quality depends on the image resolution, but at least you have the guarantee that it will look the same.

Best would be to have support for both options (SVG and image based PDF export) and to let the user decide which one to use.

mflorea commented 4 years ago

One solution that @oanalavinia and I discussed is to add a new boolean property exportUsingSVG to the DiagramClass. We don't foresee adding a new type of PDF export besides image and SVG so in order to keep thinks simple a boolean flag should be enough. DiagramViewSheet and DiagramMacro would take this property into account when the diagram is exported to PDF. Of course, DiagramEditSheet needs to be modified to generate the diagram image and attach it along with the diagram SVG to the diagram page.

mflorea commented 4 years ago

Note that for IE11 only SVG-based PDF export will be available. This means that both DiagramViewSheet and DiagramMacro have to fallback on SVG PDF export if exportUsingSVG is false and the diagram image is missing.

oanalavinia commented 4 years ago

As a conclusion, to choose between SVG-based and image-based XWiki PDF export, a diagram must be edited in object mode for modifying exportUsingSVG property. By default, the property is set to true.