archi-scripting-plugin icon indicating copy to clipboard operation
archi-scripting-plugin copied to clipboard

Feature Request: Text clipping workaround for .renderViewToPDF()

Open davidsara opened this issue 1 year ago • 3 comments
trafficstars

Hello! Is it possible to add Text clipping workaround as a parameter of .renderViewToPDF() function? I'm using jArchi script for batch PDF export and need this parameter to fix issues with missing part of last character of some texts.

image

Thanks! David

davidsara avatar Mar 22 '24 07:03 davidsara

This can happen with certain fonts. In the meantime you could try a different font. I'll add this one to the list.

Phillipus avatar Mar 22 '24 10:03 Phillipus

Thank you!

davidsara avatar Mar 22 '24 12:03 davidsara

For the next version of jArchi we will support a map of options for the SVG and PDF image export.

The current API for SVG and PDF is:

$.model.renderViewAsSVGString(view, setViewBox) $.model.renderViewToSVG(view, filePath, setViewBox) $.model.renderViewToPDF(view, filePath)

We can add extra functions that take a map of options in the arguments:

$.model.renderViewAsSVGString(view, options) $.model.renderViewToSVG(view, filePath, options) $.model.renderViewToPDF(view, filePath, options)

Examples:

var svgOptions = {setViewBox: true, viewBoxBounds: "0 0 1000 200", textAsShapes: false, embedFonts: true, textOffsetWorkaround: true};
var svgString = $.model.renderViewAsSVGString(view, svgOptions);
$.model.renderViewToSVG(view, "pathTo/test.svg", svgOptions);

var pdfOptions = {textAsShapes: false, embedFonts: true, textOffsetWorkaround: true};
$.model.renderViewToPDF(view, "pathTo/test.pdf", pdfOptions);

Each option can be omitted if required so you can set just one or two options. The defaults are:

setViewBox: true (this option applies only to SVG export)
viewBoxBounds: null (this option applies only to SVG export)
textAsShapes: true
embedFonts: false
textOffsetWorkaround: false

Phillipus avatar Aug 18 '24 15:08 Phillipus