33 lines
829 B
Go
33 lines
829 B
Go
package html2pdf
|
|
|
|
import "gitea.tecamino.com/paadi/html2pdf.git/converter"
|
|
|
|
func Convert(chromePath, inputFile, outputFile string) error {
|
|
c := converter.NewConverter(chromePath)
|
|
return c.Convert(inputFile, outputFile)
|
|
// chromePath := "chrome-headless-shell"
|
|
// htmlURL := "file://"
|
|
// switch runtime.GOOS {
|
|
// case "windows":
|
|
// chromePath += ".exe"
|
|
// htmlURL += "/"
|
|
// default:
|
|
// }
|
|
|
|
// // Convert to absolute path
|
|
// absPath, err := filepath.Abs(imputFile)
|
|
// if err != nil {
|
|
// return err
|
|
// }
|
|
|
|
// htmlURL += filepath.ToSlash(absPath)
|
|
// chromePath = filepath.Join(c.chromePath, chromePath)
|
|
|
|
// opts := append(chromedp.DefaultExecAllocatorOptions[:],
|
|
// chromedp.ExecPath(chromePath),
|
|
// chromedp.NoSandbox,
|
|
// chromedp.Headless,
|
|
// chromedp.DisableGPU,
|
|
// )
|
|
}
|