diff --git a/internal/epub/core.go b/internal/epub/core.go index 5a04503..b0f4c5b 100644 --- a/internal/epub/core.go +++ b/internal/epub/core.go @@ -97,13 +97,8 @@ func (e *ePub) writeImage(wz *epubZip, img *Image) error { err := wz.WriteFile( fmt.Sprintf("OEBPS/%s", img.TextPath()), e.render(textTmpl, map[string]any{ - "Title": fmt.Sprintf("Image %d Part %d", img.Id, img.Part), - "ViewPort": fmt.Sprintf("width=%d, height=%d", e.ViewWidth, e.ViewHeight), - "ImageStyle": fmt.Sprintf( - "width:%dpx; height:%dpx;", - img.Width, - img.Height, - ), + "Title": fmt.Sprintf("Image %d Part %d", img.Id, img.Part), + "ViewPort": fmt.Sprintf("width=%d,height=%d", e.ViewWidth, e.ViewHeight), "ImagePath": img.ImgPath(), }), ) @@ -120,7 +115,7 @@ func (e *ePub) writeBlank(wz *epubZip, img *Image) error { fmt.Sprintf("OEBPS/Text/%d_sp.xhtml", img.Id), e.render(blankTmpl, map[string]any{ "Title": fmt.Sprintf("Blank Page %d", img.Id), - "ViewPort": fmt.Sprintf("width=%d, height=%d", e.ViewWidth, e.ViewHeight), + "ViewPort": fmt.Sprintf("width=%d,height=%d", e.ViewWidth, e.ViewHeight), }), ) } diff --git a/internal/epub/templates/blank.xhtml.tmpl b/internal/epub/templates/blank.xhtml.tmpl index e3ba233..0722dfc 100644 --- a/internal/epub/templates/blank.xhtml.tmpl +++ b/internal/epub/templates/blank.xhtml.tmpl @@ -2,6 +2,7 @@ + {{ .Title }} diff --git a/internal/epub/templates/style.css.tmpl b/internal/epub/templates/style.css.tmpl index 2cac722..a8d41d9 100644 --- a/internal/epub/templates/style.css.tmpl +++ b/internal/epub/templates/style.css.tmpl @@ -1,13 +1,22 @@ body { color: #000; background: #FFF; + top: 0; + left: 0; margin: 0; padding: 0; width: {{ .PageWidth }}px; height: {{ .PageHeight }}px; + text-align: center; } -div { +img { + position: absolute; margin:0; padding:0; + z-index:0; + top:0; + left:0; + width: {{ .PageWidth }}px; + height: {{ .PageHeight }}px; } \ No newline at end of file diff --git a/internal/epub/templates/text.xhtml.tmpl b/internal/epub/templates/text.xhtml.tmpl index 5741e3d..6a509d8 100644 --- a/internal/epub/templates/text.xhtml.tmpl +++ b/internal/epub/templates/text.xhtml.tmpl @@ -2,13 +2,14 @@ + {{ .Title }}
- + {{ .Title }}
\ No newline at end of file diff --git a/internal/epub/templates/title.xhtml.tmpl b/internal/epub/templates/title.xhtml.tmpl index c152015..037886c 100644 --- a/internal/epub/templates/title.xhtml.tmpl +++ b/internal/epub/templates/title.xhtml.tmpl @@ -2,6 +2,7 @@ + Part {{ .Part }}