-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to disable-javascript config #31
Comments
Hi @zjkyz8, You can disable package main
import (
"log"
"os"
pdf "github.com/adrg/go-wkhtmltopdf"
)
func main() {
// Initialize library.
if err := pdf.Init(); err != nil {
log.Fatal(err)
}
defer pdf.Destroy()
// Create object from URL.
object, err := pdf.NewObject("https://google.com")
if err != nil {
log.Fatal(err)
}
object.EnableJavascript = false
// Create converter.
converter, err := pdf.NewConverter()
if err != nil {
log.Fatal(err)
}
defer converter.Destroy()
// Add created objects to the converter.
converter.Add(object)
// Convert objects and save the output PDF document.
outFile, err := os.Create("out.pdf")
if err != nil {
log.Fatal(err)
}
defer outFile.Close()
// Run converter.
if err := converter.Run(outFile); err != nil {
log.Fatal(err)
}
} |
Hi @adrg After I disable javascript,converting still hang up at 10%. but if i do pdf.Init() before every convert, that will be ok. so do i need to do init before every convert? By the way, I use a Gin to setup a web server with other functions. Thanks a lot |
No, calling
|
I use mainthread to make all logic run in main thread. If I call pdf.Init() one time when app staring up instead of call it before every convert, i found it will hang up at 10% without any error. Do you have any idea about this weird situation? |
I'm not sure. It's hard to tell without seeing your code. |
Hi guys,
how can i pass disable-javascript to wkhtmltopdf? Currently, the converter will hang up at 10%, and someone told disable-javascript need to set, this is link, so i want try.
Thanks
The text was updated successfully, but these errors were encountered: