Skip to content

EPUB conversion doesn't handle CSS background-image property in style attributes #284

@rtonsing

Description

@rtonsing

See source for ebook #25344.

This is an example of the code causing the critical errors, it is a relative reference:
<div class="backright" style="background-image: url(images/illu_057.jpg); height: 100%;">

The error is:

2025-07-13 12:00:23,906 CRITICAL  #25344 ERROR(RSC-030): /export/sunsite/users/gutenbackend/cache/epub/25344/pg25344.epub/OEBPS/8134824478036869322_25344-h-1.htm.html(767,1): File URLs are not allowed in EPUB, but found "file:///public/vhost/g/gutenberg/html/files/25344/25344-h/images/illu_057.jpg".
ERROR(OPF-014): /export/sunsite/users/gutenbackend/cache/epub/25344/pg25344.epub/OEBPS/8134824478036869322_25344-h-1.htm.html(766,0): The property "remote-resources" should be declared in the OPF file.

output.txt

In the current epub3 (posted in 2021), those images are missing.

When I use Calibre to convert the HTML, the styling appears to work OK, see attached screenshot. The OPF file does not declare "remote-resources". It passes epubcheck.

If at all possible, it would be ideal to allow this property. It has long been a desire at PGDP to handle wrapping of text around images, or even overlapping.

Calibre produced epub - mangles page numbers, but otherwise looks good.
25344-epub.zip

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions