Switch to folio for document rendering

This commit is contained in:
Milan Nikolic
2026-08-24 15:40:38 +02:00
parent 38cb375a93
commit b8bf8fa9df
18 changed files with 183 additions and 189 deletions
+10 -5
View File
@@ -15,7 +15,7 @@ import (
pngstructure "github.com/dsoprea/go-png-image-structure"
"github.com/dustin/go-humanize"
"github.com/gen2brain/go-fitz"
folio "github.com/gen2brain/folio/doc"
)
// Options type.
@@ -214,12 +214,17 @@ func (o Options) Args() []string {
// renderPage renders document page n at the configured DPI, or at the page's
// native resolution when DPI is unset.
func (c *Converter) renderPage(doc *fitz.Document, n int) (*image.RGBA, error) {
if c.Opts.DPI > 0 {
return doc.ImageDPI(n, float64(c.Opts.DPI))
func (c *Converter) renderPage(doc folio.Document, n int) (*image.RGBA, error) {
page, err := doc.Page(n)
if err != nil {
return nil, err
}
return doc.Image(n)
if c.Opts.DPI > 0 {
return page.ImageDPI(float64(c.Opts.DPI))
}
return page.Image()
}
// Cancel cancels the operation.