You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using dominant-baseline and alignment-baseline attributes in a Custom Visualization to set a text element position in the svg viewport as hanging in a report generated from a custom Java application using JasperReports Library version 6.16, the resulting pdf is rendered ignoring them independently on whether PhantomJs or Chromium is used, resulting in the text being located outside of the viewport. Nevertheless, if the report is exported as html, the report is rendered correctly in the same version of chromium that I am bundling with the executable.
Additionally, this problem also happens when the same report is exported in html and opened inside Jaspersoft Studio Community, yet if the html file is opened in chrome it is also rendered correctly.
According to some answers in stackoverflow, this error can be caused due to inhereting the svg a display inline attribute from the html in which it is embedded. However, setting the svg display attribute to block does not solve it.
A workaround for solving this is to set the dy property of the text to 0.75em, but the resulting top margin might change if several texts with different font sizes are used.
Example of the D3js code that generates one of those text elements:
var cents_text = svg.append("text")
.attr('dominant-baseline', "hanging") // set text baseline
.attr('alignment-baseline', "hanging") // set viewport baseline
.attr("text-anchor", "end") // left alignment
.attr("x", w) // set x position of left side of the text
.attr("y", 0) // set y position of upper side of the text
.attr("class", "number-text") // set css class
.text(cents) // define the text to display
.style('font-size', "60px");
And its CSS style:
.number-text {
fill: white;
font-family: arial;
}
The text was updated successfully, but these errors were encountered:
When using dominant-baseline and alignment-baseline attributes in a Custom Visualization to set a text element position in the svg viewport as hanging in a report generated from a custom Java application using JasperReports Library version 6.16, the resulting pdf is rendered ignoring them independently on whether PhantomJs or Chromium is used, resulting in the text being located outside of the viewport. Nevertheless, if the report is exported as html, the report is rendered correctly in the same version of chromium that I am bundling with the executable.
Additionally, this problem also happens when the same report is exported in html and opened inside Jaspersoft Studio Community, yet if the html file is opened in chrome it is also rendered correctly.
According to some answers in stackoverflow, this error can be caused due to inhereting the svg a display inline attribute from the html in which it is embedded. However, setting the svg display attribute to block does not solve it.
A workaround for solving this is to set the dy property of the text to 0.75em, but the resulting top margin might change if several texts with different font sizes are used.
This problem was initially mentioned in #189 (comment)
Thanks in advance
Generated SVG passed to Chromium or PhantomJS:
Example of the D3js code that generates one of those text elements:
And its CSS style:
The text was updated successfully, but these errors were encountered: