I'm trying to log the output of the wkhtmltopdf EXE to a file however the log file it creates is just blank lines with no actual output. I can see the output in the CMD window but the file the command is redirected to is blank.
C:\PROGRA~1\wkhtmltopdf\bin\wkhtmltopdf >> C:\test.txt
In the CMD window I see the documentation for wkhtmltopdf, like the below:
Name:
wkhtmltopdf 0.12.5 (with patched qt)
Synopsis:
wkhtmltopdf [GLOBAL OPTION]... [OBJECT]...
but the output file has 16 blank lines?
I've tried various alternative ways of running the command, using cmd /c or the START command, tried with powershell as well but have had no joy so far.
Any help with this would be much appreciated, thank you!
I was able to resolve this by changing the command as follows, thanks to Cpt.Whale comment for pointing me in the right direction!
C:\PROGRA~1\wkhtmltopdf\bin\wkhtmltopdf 1>> C:\test.txt 2>&1
I want to open a HTML file using cmd, located in the autostart folder using internet explorer, even tho for example Firefox is selected for standard browser.
I already navigated to the autostart folder.
How can I do that?
Or what is the command for that?
%ProgramFiles%\Internet Explorer\iexplore.exe" file://path_to_file
Refer to the command line options for IE11 for details of options that you might need
I am using this command to generate the screenshot
chrome --headless --disable-gpu --screenshot --window-size=1280,1696
It's generating the output in current directory with name screenshot.jpeg. I want to change the default output directory as well as output filename. Can somebody tell me the correct options I need to use?
you can specify your filename in --screenshot option.
eg.,
chrome --headless --disable-gpu --screenshot=newfilename.png https://www.chromestatus.com/
I have many .odt files in my Windows system. I would like to convert these files to PDF. I tried that in command line
soffice.bin --headless -convert-to pdf:"writer_pdf_Export" c:\MyOdtFile.odt
But, It does not work. This method can only open file, does not convert!
How can I do this?
With LibreOffice, the following command should work:
soffice.exe --headless -convert-to pdf --outdir <output directory> <file1.odt> <file2.odt>
When converting to pdf, -convert-to pdf is sufficient. The --outdir parameter is optional; if you don't use it, the PDF will be created in the current working directory. Using soffice.bin didn't work for me (missing sal3.dll), but soffice.exe works (LibreOffice 4.2.4.2, Win 7). If soffice.exe isn't in your path, you would have to set the PATH explicitly or add the complete path to the command above:
' "C:\Program Files (x86)\LibreOffice 4\program\soffice.exe" --headless -convert-to pdf --outdir C:\temp test1.odt`
Make sure that LO isn't running when issuing the convert command - otherwise the conversion will fail without an error message.
To add to #tohuwawohu's answer... he wrote:
Make sure that LO isn't running when issuing the convert command - otherwise the conversion will fail without an error message.
This can be eliminated by adding another parameter to the command line:
-env:UserInstallation=file:///tmp/LibreOffice_Conversion_${USER}"
This creates a new environment for ${USER}'s headless instance of LibreOffice, should he have already a not-headless, GUI one running.
This way, the headless instance will not conflict with the already running instance.
I'm trying to find a shell command that will open Google Chrome with specific x and y coordinates (so that I can set the position of the window when it opens.) Is it possible to do this using command line-arguments?
I need to modify the following command in order to achieve this:
google-chrome http://www.google.com/
When you're using Google's Chrome, there is a shorter way:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
--profile-directory="Default"
--app="data:text/html,<html><body><script>window.moveTo(580,240);window.resizeTo(800,600);window.location='http://www.test.de';</script></body></html>"
Pro:
Automatically opens the window
Avoids the popup-blocker
Opens multiple windows on different monitors (multi monitor setup, requires two or more Chrome profiles)
Con:
Only seems to work in "app" Mode
Not tested with other browsers
http://peter.sh/experiments/chromium-command-line-switches/ says --window-position=x,y is what you're looking for.
Updating this years later to include a small shell script I wrote years ago (but after answering this question) that provides an example of how to start chrome with custom window sizes/position and has the ability to create 'fake' user data directories by name.
It may or may not still work, and has some dangerous options set, but you get the idea.. Do not use this verbatim, some of the flags may have been renamed or been removed entirely.. (like the socks proxy commands did)
#!/bin/bash -x
FAKEUSER="${1:-fake-chrome-user}"
CHROMEROOT=$HOME/.chromeroot/
mkdir -p ${CHROMEROOT}
export PROFILE="${CHROMEROOT}/${FAKEUSER}-chromium-profile"
export DISK_CACHEDIR="${CHROMEROOT}/${FAKEUSER}-chromium-profile-cache"
export DISK_CACHESIZE=4096
export MEDIA_CACHESIZE=4096
PARANOID_OPTIONS="\
--no-displaying-insecure-content \
--no-referrers \
--disable-zero-suggest \
--disable-sync \
--cipher-suite-blacklist=0x0004,0x0005,0xc011,0xc007 \
--enable-sandbox-logging >/dev/null 2>&1
"
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
--remember-cert-error-decisions \
--ignore-certificate-errors \
--ignore-urlfetcher-cert-requests \
--allow-running-insecure-content \
--window-position=2400,400 \
--window-size=1500,1000 \
--no-pings \
--user-data-dir=${PROFILE} \
--disk-cache-dir=${DISK_CACHEDIR} \
--disk-cache-size=${DISK_CACHESIZE} \
--media-cache-size=${MEDIA_CACHESIZE} \
2>&1
#--proxy-server="socks4://localhost:30604" \
#--host-resolver-rules="MAP * 0.0.0.0 , EXCLUDE localhost" \
To build on #synthesizerpatel's answer, --window-position won't work on it's own.
You'll need to launch it as it's own new instance using --user-data-dir or --chrome-frame like:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --user-data-dir=XXXXXXXXXX --window-size=800,600 --window-position=580,240 --app="http://www.google.com/"
or
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --chrome-frame --window-size=800,600 --window-position=580,240 --app="http://www.google.com/"
Unfortunately for me, having it as a new instance means it doesn't carry over the session/cookie/etc info from other instances, so I've had to open it normally (with only the --app parameter), then have javascript in the page I open do:
window.moveTo(580,240);
window.resizeTo(800,600);
I guess if you were opening a webpage owned by someone else, you could open your own webpage that has the above js, and then navigates to their webpage.
I've used this:
google-chrome "data:text/html;charset=ISO-8859-1,<html>
<head></head><body><script language=\"javascript\">
window.open('http://perso.f-hauri.ch/~felix/svg/dustin_w_Clock_autonom.svg',
'clock','toolbar=0,location=0,status=0,menubar=0,scrollbars=1,'
+'resizable=1,width=600,height=600,top=100,left=120');</script>"
but google-chrome block popup windows, so this:
google-chrome "data:text/html;charset=ISO-8859-1,<html><head></head><body>
<button onclick=\"javascript:window.open(
'http://perso.f-hauri.ch/~felix/svg/dustin_w_Clock_autonom.svg',
'clock','toolbar=0,location=0,status=0,menubar=0,scrollbars=1,'
+'resizable=1,width=600,height=600,top=100,left=120');\"> clock </button>"
give a nice way to do this.
Nota: This work as well with firefox too.
With my latest version of Chrome - I only needed the following. Everytime I closed the app, it remembered my window size and position.
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --chrome-frame --app=https://mightytext.net/web8/?exp=1
This worked for me in Version 48.0.2564.48 beta-m (64-bit)
and Version 48.0.2564.48 beta-m (64-bit)