Created
February 7, 2019 19:55
-
-
Save jamesdaily/05887de933d131549cb69e4829d466f4 to your computer and use it in GitHub Desktop.
Windows Batch file to invoke "print-to-pdf" feature in headless Chrome
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
IF %1.==. GOTO NoHtmlFile | |
SET CURRENTDIR=%cd% | |
set htmlFile=%1 | |
start "C:\Program Files (x86)\Google\Chrome\Application" chrome.exe --headless --disable-gpu --no-margins --print-to-pdf="%CURRENTDIR%\%htmlFile%.pdf" "%CURRENTDIR%\%htmlFile%" | |
GOTO End1 | |
:NoHtmlFile | |
ECHO Must specify HTML file or URL | |
GOTO End1 | |
:End1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment