cefHtmlSnapshot v0.2.88 has the sandbox mode active by default and introduces new security-oriented features:
- added no-sandbox option
- support specifying the URL through a .url file
- added ignore-certificate-errors option
- fixed handling of ‘-h’ to disambiguate between help and height
zip file contains only updated cefHtmlSnapshot.exe (overwrite the one from release v0.1.88)
In previous pre-releases, sandbox was off by default, this was an oversight, and sandbox is now on by defaut.
The .url file format is basically an INI file, an unofficial description can be found there. Besides previewing links, it can be used in case you are going to call the binary from a command-line shell (rather than CreateProcess for instance), and want to prevent command injection.
Updated inline doc below
cefHtmlSnapshot.exe url_or_file [-arg1 value1] [-arg2 value2] ... output_file
-?, -h, --help This inline documentation
url_or_file URL of the website or file to be snapshotted (required)
If a .url file is specified, the URL will be read from it
output_file Output file pathname, extension determines format (default snapshot.bmp)
-w, --width Width of the snapshot, between 1 and 2048 (default 1024)
-h, --height Height of the snapshot, between 1 and 2048 (default 768)
When output format is a PDF, this parameter is ignored
-d, --delay Delay in milliseconds, between 100 ms and 30 sec (default 1 sec)
-s, --scale Scale of the website relative to 96dpi, between 0.1 and 10.0 (default 1.0)
--quality Output JPEG quality (1 to 100, default 90)
--compression Output PNG compresson level (0 to 9, default 7)
--cookie set a cookie, format is CommaText, starting with name=value, then fields
url= cookie url (uses scheme + domain from url parameter by default)
domain= cookie domain (uses domain from url parameter by default)
path= cookie path ("/" by default)
secure= secure flag (0 or 1, by default 1 if url starts with "https:")
httponly= htpOnly flag (0 or 1, by default 0)
--javascript Name of a JavaScript file to execute just before taking the snapshot
--ignore-certificate-errors Turns on/off certificate checks (0 or 1, by default 0)
--no-sandbox Turns on/off sandbox (0 or 1, by default 0)
--pdf-xxx PDF output options outlined below
page-width page width in microns (default 210000)
page-height page height in microns (default 297000)
margins sets all margins in points
margin-top top margin in points (default 20)
margin-left left margin in points (default 20)
margin-right right margin in points (default 20)
margin-bottom bottom margin in points (default 20)
landscape portait (default, 0) or landscape (1)
backgrounds enable backgrounds (1) or not (default, 0)
I use this tool snapshot http://www.nju.edu.cn .but I get some javscript code mixed with webpage. to pdf get same result. cmdline :cefHtmlSnapshot.exe http://www.nju.edu.cn snapshot.jpg
I just tested, and the jpg & pdf came out ok, the jpg f.i. was https://imgur.com/a/1t8XY0c
What did you get exactly ? (you can open an issue at https://github.com/EricGrange/cefHtmlSnapshot/issues, it may be more practical than here)