-
Notifications
You must be signed in to change notification settings - Fork 4
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
This works insanely good #10
Comments
Thanks for the feedback!
FileInfo struct:
2, 3: I think you can disable Javascript and configure your browser path, but I would have to take a look at go-rod API For this, I would have to do some changes in the Webdrive file. Maybe I can create an interface and let it be extendable, but I'll have to take a more detailed look. |
Thanks for your answer! I saw the new api before you answer, thats much better. But what is the page? 😅 func (mail *mail) generatePdf(pdfGen handlers.FileHandler[orcgen.PDFConfig]) (*fileinfo.Fileinfo, error) {
count := counter.CreateCounter()
var htmlBody []byte
for _, body := range mail.Body {
if mime := mimetype.Detect(body); !mime.Is("text/html") {
continue
}
htmlBody = append(htmlBody, body...)
count.Next()
}
if count.Current() == 0 {
return nil, nil
}
return pdfGen.SetFullPage(true).GenerateFile(&rod.Page{}) ???
} |
You can take a look at the examples_test.go
This uses the webdriver directly. If you need to change JS and browser settings, I think it's the way to go. I'll problably add these options in the webdriver config later. But for now, there's a simpler way to get the file bytes:
or
|
no i already have the file bytes - i just want to convert my html bytes to the pdf bytes |
just want to fill the page param: return pdfGen.SetFullPage(true).GenerateFile(page somehow from my html bytes) |
(and want to have multi page pdf like here: #2) |
Ok sorry, got it: the api could be a bit easier imo but its just amazing also german umlauts somehow works - maybe its only for some emails Thank you! |
Looks like fileInfo is nil in some edge case 49 / 322 [------------------------------>__________________________________________________________________________________________________________________________________________________________________________] 15.22% 4 p/spanic: runtime error: invalid memory address or nil pointer dereference goroutine 1 [running]: |
while the file bytes is not 0 - sure you capture any err in the GenerateHTML function? maybe this happens when the timeout of the webdriver is reached sorry for all the spam |
All good, found the issue - was my fault. |
Sometimes this panics btw, would be good to handle this error panic: context deadline exceeded goroutine 1 [running]: |
Hey, I will be really busy these following weeks - feel free to contribute if you need something faster |
Really good job! Works so much better then wkhtmltopdf
I would love to migrate to this with https://github.com/loeffel-io/mail-downloader.
should return the file bytes and the error to create the file myself with the permissions i want etc
With wkhtmltopdf i was able to disable javascript - is this possible?
I would love to do the download of the browser before i start converting pdfs, because this results in:
Sie möcht
. Would be great to have UTF-8 (?)Thank you!
The text was updated successfully, but these errors were encountered: