fix duplicate blank page if last page is double

This commit is contained in:
Celogeek 2023-04-27 18:32:48 +02:00
parent 42eba9cb3b
commit 06cc6d2788
Signed by: celogeek
SSH Key Fingerprint: SHA256:njNJLzoLQdbV9PC6ehcruRb0QnEgxABoCYZ+0+aUIYc
2 changed files with 7 additions and 3 deletions

View File

@ -292,8 +292,9 @@ func (e *ePub) Write() error {
return err
}
// Double Page or Last Image
if img.Image.DoublePage || (i+1 == len(part.LoadedImages)) {
// Double Page or Last Image that is not a double page
if img.Image.DoublePage ||
(img.Image.Part == 0 && i+1 == len(part.LoadedImages)) {
if err := e.writeBlank(wz, img.Image); err != nil {
return err
}

View File

@ -150,7 +150,10 @@ func getManifest(o *ContentOptions) []tag {
}
items = append(items, itag(img), htag(img))
}
items = append(items, stag(o.Images[len(o.Images)-1]))
lastImage := o.Images[len(o.Images)-1]
if lastImage.Part == 0 {
items = append(items, stag(lastImage))
}
return items
}