Skip to content

Instantly share code, notes, and snippets.

View lukelbd's full-sized avatar

Luke Davis lukelbd

  • University of East Anglia
  • Norwich, UK
View GitHub Profile
@lukelbd
lukelbd / pdf-recolor.py
Last active October 7, 2022 20:48
Script to change the color of the highlight annotations in PDF document(s).
#!/usr/bin/env python
"""
Change the color of the highlight annotations in PDF document(s).
The destination color is hardcoded in this script.
"""
# Adapted from:
# https://unix.stackexchange.com/a/118492/112647
# PDF format reference:
# http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/PDF32000_2008.pdf
# pages 12 to 13 define the character sets