Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use SVGs as content images #4

Closed
CClerger opened this issue Oct 21, 2019 · 0 comments
Closed

Cannot use SVGs as content images #4

CClerger opened this issue Oct 21, 2019 · 0 comments

Comments

@CClerger
Copy link
Contributor

Problem

I'm trying to convert a file containing the following html to a SVG or a PNG:

<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body><!----><!----><!----><!----><table border="0" cellpadding="0" cellspacing="0" style="background-color: #fff; border: 1px solid rgba(0, 0, 0, 0.12); border-radius: 15px;" class="ng-star-inserted"><thead><tr><td style="text-align: center; color: #1a96b0; border-bottom: 1px solid rgba(0, 0, 0, 0.12); padding: 8px" colspan="2"><b>Royal Caribbean - Mystery Shop 2019</b> Alternative Companies<!----><i class="ng-star-inserted"> Celebrity X Cruise</i></td></tr><tr><th style="border-bottom: 1px solid #1a96b0; border-right: 1px solid #1a96b0; "></th><!----><th style="border-bottom: 1px solid #1a96b0" class="ng-star-inserted"><div style="padding: 8px; text-align: center"><span style="font-weight: bold; color: rgba(0, 0, 0, 0.54); font-size: 12px">Travel Mystery Shop</span><!----></div></th><!----></tr></thead><tbody><!----><tr class="ng-star-inserted"><td><div style="padding: 8px; text-align: center;"><!----><p class="ng-star-inserted"><img style="max-width: 80px; max-height: 80px" src="https://s3-eu-west-1.amazonaws.com/storechain-logos/store_types/travel_agency.svg"></p><span style="font-weight: bold"><small>TRAVEL_AGENCY - GB</small></span></div></td><!----><td class="ng-star-inserted"><div style="padding: 8px; text-align: center; font-size: 24px"><!----><!----><!----><span class="ng-star-inserted"> 4.54% </span></div></td><!----></tr></tbody><!----></table><!----></body></html>

The resulting image does not display the content image (https://s3-eu-west-1.amazonaws.com/storechain-logos/store_types/travel_agency.svg). But everything works if I use another image format, such as a PNG:

<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body><!----><!----><!----><!----><table border="0" cellpadding="0" cellspacing="0" style="background-color: #fff; border: 1px solid rgba(0, 0, 0, 0.12); border-radius: 15px;" class="ng-star-inserted"><thead><tr><td style="text-align: center; color: #1a96b0; border-bottom: 1px solid rgba(0, 0, 0, 0.12); padding: 8px" colspan="2"><b>Royal Caribbean - Mystery Shop 2019</b> Alternative Companies<!----><i class="ng-star-inserted"> Celebrity X Cruise</i></td></tr><tr><th style="border-bottom: 1px solid #1a96b0; border-right: 1px solid #1a96b0; "></th><!----><th style="border-bottom: 1px solid #1a96b0" class="ng-star-inserted"><div style="padding: 8px; text-align: center"><span style="font-weight: bold; color: rgba(0, 0, 0, 0.54); font-size: 12px">Travel Mystery Shop</span><!----></div></th><!----></tr></thead><tbody><!----><tr class="ng-star-inserted"><td><div style="padding: 8px; text-align: center;"><!----><p class="ng-star-inserted"><img style="max-width: 80px; max-height: 80px" src="https://storechain-logos.s3-eu-west-1.amazonaws.com/7_Eleven.PNG"></p><span style="font-weight: bold"><small>TRAVEL_AGENCY - GB</small></span></div></td><!----><td class="ng-star-inserted"><div style="padding: 8px; text-align: center; font-size: 24px"><!----><!----><!----><span class="ng-star-inserted"> 4.54% </span></div></td><!----></tr></tbody><!----></table><!----></body></html>

Possible solution

I've ran into a similar issue while trying to use cssbox directly. It's using ImageIO to read the images, so you might need to add a dependency to com.twelvemonkeys.imageio:imageio-batik to your project for it to work. Hope it helps :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant