Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e6e833533e | ||
|
|
1822fc3628 |
@@ -128,7 +128,10 @@ func (c *Converter) Convert(files ...models.File) error {
|
|||||||
|
|
||||||
// Convert converts all given input files
|
// Convert converts all given input files
|
||||||
func (c *Converter) ConvertHtmls(htmls ...models.Html) error {
|
func (c *Converter) ConvertHtmls(htmls ...models.Html) error {
|
||||||
for _, h := range htmls {
|
for i, h := range htmls {
|
||||||
|
if c.progress != nil {
|
||||||
|
c.progress(i + 1)
|
||||||
|
}
|
||||||
if len(h.Html) == 0 {
|
if len(h.Html) == 0 {
|
||||||
return fmt.Errorf("no .html input provided")
|
return fmt.Errorf("no .html input provided")
|
||||||
} else if h.Output == "" || filepath.Ext(h.Output) != ".pdf" {
|
} else if h.Output == "" || filepath.Ext(h.Output) != ".pdf" {
|
||||||
|
|||||||
9
models/html.go
Normal file
9
models/html.go
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type Htmls []Html
|
||||||
|
|
||||||
|
// input model for converter
|
||||||
|
type Html struct {
|
||||||
|
Html []byte
|
||||||
|
Output string
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user