2024-10-30 00:03:39 +01:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
"os/exec"
|
|
|
|
)
|
|
|
|
|
|
|
|
func check(e error) bool {
|
|
|
|
if e != nil {
|
|
|
|
fmt.Println(e)
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
func fileExists(filename string) bool {
|
|
|
|
info, err := os.Stat(filename)
|
|
|
|
if os.IsNotExist(err) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
return !info.IsDir()
|
|
|
|
}
|
|
|
|
|
|
|
|
func fileToString(filename string) string {
|
|
|
|
b, err := os.ReadFile(filename)
|
|
|
|
check(err)
|
|
|
|
return string(b)
|
|
|
|
}
|
|
|
|
|
|
|
|
func makepdf(odtdatei string) {
|
2024-11-03 20:33:55 +01:00
|
|
|
cmd := exec.Command("/usr/lib/libreoffice/program/soffice.bin", "--headless", "--convert-to", "--embed-fonts", "pdf", "--outdir", "./www/data", odtdatei)
|
2024-10-30 00:03:39 +01:00
|
|
|
output, err := cmd.Output()
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println("Fehler beim Ausführen des Befehls:", err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
fmt.Println(string(output))
|
|
|
|
}
|