- 1 year ago
How to sign in in wkhtmltopdf to convert page of website that requires login
To sign in to a website with wkhtmltopdf, you can use the --username
and --password
options to provide the login credentials. Here's an example command:
csswkhtmltopdf --username YOUR_USERNAME --password YOUR_PASSWORD URL OUTPUT_FILE.pdf
Replace YOUR_USERNAME
with your actual username and YOUR_PASSWORD
with your actual password. URL
should be the URL of the page you want to convert to PDF, and OUTPUT_FILE.pdf
is the desired output file name.
Make sure that the website you are trying to log in to supports basic HTTP authentication or form-based authentication, as wkhtmltopdf does not support more complex authentication methods like OAuth or SSO. If the website uses JavaScript-based authentication, you may need to use a different tool or approach to automate the login process before generating the PDF.
Additionally, keep in mind that providing login credentials via command-line options may expose them in the command history or other logs. Use this approach with caution, especially if you are sharing or storing the command history.