gogap / go-wkhtmltox Goto Github PK
View Code? Open in Web Editor NEWA web service for wkhtmltopdf and wkhtmltoimage
License: Apache License 2.0
A web service for wkhtmltopdf and wkhtmltoimage
License: Apache License 2.0
Any way to get more verbose output? Would be nice to see the standard out logged somewhere?
Hello again,
Is it possible it implement any access control to the service? Such as CORS?
For example only let requests from http://www.example.com execute conversions?
Access-Control-Allow-Origin: http://www.example.com
Bit of a Docker beginner...
Is this possible through the API? If so an example would be much appreciated :)
Essentially I would like to be able to pass the --javascript-delay
option for fetching slower or javascript-based sites.
Cheers
Hi,
I use https://github.com/idocking/go-wkhtmltox docker container with wkhtmltopdf 0.12.5 (with patched qt).
I try to set GlobalOptions like this:
"converter": {
"url": null,
"extend": {
"footer-left": "[date]",
"footer-right": "Prepared [date] [page]/[topage]",
"footer-font-size": "10",
"margin-bottom": "20",
"footer-spacing": "10"
}
},
I use space like in footer-right line I get error when convert to pdf:
open /tmp/go-wkhtmltox212187195/41f80aa7-be68-4437-9d43-27bb8f520780.pdf: no such file or directory
When I delete space in string line this "Prepared[date][page]/[topage]" everything work fine.
Any ideas how to escape space?
I'm new to Go so I'm gessing, but it seems quality is not added to args
in ToImageOptions.
The fact is that calling the API as README suggest doesn't work as espected:
{
"to" : "image",
"converter":{
"format" : "png",
"quality": "0",
"uri": "https://sbit.io"
},
"template": "binary"
}
But calling the API with extend works:
{
"to" : "image",
"converter":{
"format" : "png",
"extend": {"quality": "0" },
"uri": "https://sbit.io"
},
"template": "binary"
}
Please note that 0 is a must param for PNG images as indicated in wkhtmltopdf/wkhtmltopdf#2608
/cc @jonhattan @facine
I am using go-wkhtmltox
package as a library instead of a service. I currently see issues when I try to convert html to pdf (html to image is working fine).
Sample Code
htmlToX, err := wkhtmltox.New(conf)
fetcherOpts := wkhtmltox.FetcherOptions{}
var convertOpts wkhtmltox.ConvertOptions
convertOpts = &wkhtmltox.ToPDFOptions{URI: "https://google.com"}
convData, err := htmlToX.Convert(fetcherOpts, convertOpts)
Error Details
open /var/folders/yb/xxxx/T/go-wkhtmltox539727929/79b4072e-e3ee-49a0-997d-e86ce49ab687.pdf: no such file or directory.
The error points to this line in the codebase.
Any idea on why the error is thrown? or am I missing something?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.