Forum Bugs

SVG in HTML not working?

cmahnke
I'm using the docker image `yeslogic/prince:latest`

Showing the HTML (including two SVG files referenced in a `<img>` tag) in a browsers shows two SVG images.

Prince gives this error:
```
prince: /Users/XXX/docs/usr/lib/prince/dtd/svg11/svg11.dtd: error: can't open input file: No such file or directory
prince: internal error: domain_error("float.\'/\': division by zero")
```
This raises at least two issues:
* Why does it even try to get the DTD? If it's really necessary use a bundled resource, if it ties to do so, you should ignore `--fileroot` in this case
* Why do I only get one error while two images should be processed and displayed?

mikeday
Which version of Prince are you using? That internal error looks like the biggest problem, does that trigger with one of the SVG images in particular? If so, perhaps we could examine it?
cmahnke
It's:
```
docker run yeslogic/prince:latest --version
Prince 16
Copyright 2002-2025 YesLogic Pty. Ltd.
Non-commercial License
```
I've attached the first image, I suspect it to cause the problems, since the second isn't even mentioned.
The second one is available on the net (make sure to get the SVG itself the Link is just a landing page):
https://commons.wikimedia.org/wiki/File:CC_BY-NC-SA.svg
  1. hanger.svg7.0 kB
    THe first image
mikeday
Thanks! I'm having difficulty reproducing any problems with Prince 16, did you have an other style sheets or command-line options in use?
cmahnke
I suspect the fist issue is related to the docker setup, since Prince tries to search the DTD from the `--fileroot` param, while it should certainly look into its own resources.

```
docker run -v `pwd`:`pwd` -w `pwd` yeslogic/prince:latest --fileroot `pwd`/docs docs/print.html -o catalogue.pdf
```
I'm not sure if this will already solve the second problem since this might happen since it's missing the DTD.

On the other Hand there is this:
https://www.princexml.com/forum/topic/3965/font-size-0-causes-division-by-zero-error-in-prince-12

Regarding the CSS:
CSS for the first image:
```
.title-logo {
transform: rotate(90deg);
}
```

CSS for the second (CC BY) image
```
img {
min-width: 5cm;
}
```
cmahnke
You're question gave me the right hint: it's the `min-width`, it's not supported. Changing it to `width` fixes the second error. Should probably be captured...
cmahnke
But the SVG file with the DTD reference isn't shown (Thats the CC BY icon), the line should be ignored or not mapped to the local file system:
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>
wangp
The issue with trying to load the DTD from the --fileroot directory was fixed in the 20251007 latest build, but has not yet made it to a Prince 16.x release.

I haven't been able to reproduce the division by zero bug.

`min-width` is supported.