diff --git a/src/calibre/ebooks/pdf/html_writer.py b/src/calibre/ebooks/pdf/html_writer.py
index 03814d0f04..7d25d115c1 100644
--- a/src/calibre/ebooks/pdf/html_writer.py
+++ b/src/calibre/ebooks/pdf/html_writer.py
@@ -105,7 +105,7 @@ def fix_fullscreen_images(container):
child_tags.append(tag)
if len(child_tags) > 1:
break
- if len(child_tags) == 1 and child_tags[0] == 'div':
+ if len(child_tags) == 1 and child_tags[0] in ('div', 'svg'):
names = []
svg = None
for elem in body.iterdescendants('*'):
diff --git a/src/pyj/fs_images.pyj b/src/pyj/fs_images.pyj
index 19c4d7ae96..d6c98b8c0d 100644
--- a/src/pyj/fs_images.pyj
+++ b/src/pyj/fs_images.pyj
@@ -27,8 +27,8 @@ def fix_fullscreen_svg_images():
child_names.push(name)
if child_names.length > 1:
break
- if child_names.length is 1 and child_names[0] is 'div':
- names = []
+ if child_names.length is 1 and (child_names[0] is 'div' or child_names[0] is 'svg'):
+ names = v'[]'
svg = None
for node in document.body.querySelectorAll('*'):
if node.tagName: