init
This commit is contained in:
15
README.md
Normal file
15
README.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# HTML to PDF
|
||||
|
||||
## Usage
|
||||
|
||||
1. Run the setup script on a debian machine (tested on a debian 13 LXC container)
|
||||
2. You need to set the parameters in the gen.sh file to match your environmnet.
|
||||
3. Use either of the following syntax:
|
||||
|
||||
```bash
|
||||
./gen.sh my-file.html
|
||||
```
|
||||
```
|
||||
./gen.sh oliveratkinson.net
|
||||
```
|
||||
|
||||
4
extension/inject.css
Normal file
4
extension/inject.css
Normal file
@@ -0,0 +1,4 @@
|
||||
@page {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
13
extension/manifest.json
Normal file
13
extension/manifest.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "Print CSS",
|
||||
"description": "Change the default print css for pages",
|
||||
"version": "1.0",
|
||||
"manifest_version": 3,
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": ["<all_urls>"],
|
||||
"css" : ["inject.css"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
26
gen.sh
Executable file
26
gen.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
DEV="192.168.1.179"
|
||||
USER="chrome"
|
||||
CHROME="/home/chrome/chrome/linux-144.0.7559.96/chrome-linux64/chrome"
|
||||
KEYFILE="chrome"
|
||||
|
||||
if [[ -z $1 ]]; then
|
||||
echo Requires argument
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PRINT=""
|
||||
|
||||
if [[ $(printf $1 | tail -c 4) = "html" ]]; then
|
||||
scp -i $KEYFILE $1 $USER@$DEV:/tmp/input.html
|
||||
echo html;
|
||||
PRINT="/tmp/input.html"
|
||||
else
|
||||
# This might be a bad idea, idk
|
||||
echo Assuming argument 1 is a url: $1
|
||||
PRINT=$1
|
||||
fi
|
||||
|
||||
scp -i $KEYFILE -r extension $USER@$DEV:~/
|
||||
ssh -i $KEYFILE $USER@$DEV $CHROME --headless=new --no-pdf-header-footer --print-to-pdf --load-extension="/home/$USER/extension" $PRINT
|
||||
scp -i $KEYFILE $USER@$DEV:~/*.pdf ./
|
||||
|
||||
Reference in New Issue
Block a user