Skip to content

Commit

Permalink
Merge pull request #248 from jtruitt1/main
Browse files Browse the repository at this point in the history
Update pdf-chrome derivative
  • Loading branch information
gwiedeman authored May 2, 2024
2 parents a8ac6d1 + f7e062c commit a4af068
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
pip install libpff-python==20211114
- name: Test with pytest
run: |
pytest -vv
pytest -vv
5 changes: 4 additions & 1 deletion docs/installing_mailbagit/pdf.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,23 @@ Installing [wkhtmltopdf](https://wkhtmltopdf.org/) and adding `wkhtmltopdf` or `

## Chrome Headless

Installing [Google Chrome](https://www.google.com/chrome/) and adding `chrome`, `chrome.exe` or `google-chrome` to your `PATH` will make the `pdf-chrome` derivative option available. If you have Google Chrome installed already, you may just need to add it to your `PATH`.
Installing [Google Chrome](https://www.google.com/chrome/) and adding `chrome`, `chrome.exe,` `google-chrome,` or `Google Chrome` to your `PATH` will make the `pdf-chrome` derivative option available. If you have Google Chrome installed already, you may just need to add it to your `PATH`.

For Windows, Chrome usually installs in one of these locations by default:
```
C:\Program Files\Google\Chrome\Application
C:\Program Files (x86)\Google\Chrome\Application
```

For Macs, the usual install path is `/Applications/Google\ Chrome.app/Contents/MacOS/`.

You can test if Chrome is correctly added to your `PATH` by entering the correlating command into a command line terminal:

```
chrome https://archives.albany.edu/mailbag
chrome.exe https://archives.albany.edu/mailbag
google-chrome https://archives.albany.edu/mailbag
Google\ Chrome https://archives.albany.edu/mailbag
```

If any of these commands open a Chrome browser window, you're all set!
4 changes: 2 additions & 2 deletions mailbagit/derivatives/pdf_chrome.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
skip_registry = False

try:
chromes = ["google-chrome", "chrome.exe", "chrome"]
chromes = ["google-chrome", "Google Chrome", "chrome.exe", "chrome"]
chrome = next((c for c in chromes if distutils.spawn.find_executable(c)), None)
skip_registry = True if chrome is None else False

Expand Down Expand Up @@ -72,7 +72,7 @@ def do_task_per_message(self, message):
"--headless",
"--run-all-compositor-stages-before-draw",
"--disable-gpu",
"--print-to-pdf-no-header",
"--no-pdf-header-footer",
"--print-to-pdf=" + os.path.abspath(pdf_name),
os.path.abspath(html_name),
]
Expand Down

0 comments on commit a4af068

Please sign in to comment.