Skip to content

Instantly share code, notes, and snippets.

@louispotok
louispotok / hand-modify-pdf.md
Created September 5, 2023 04:50 — forked from senderle/hand-modify-pdf.md
So you want to modify the text of a PDF by hand

So you want to modify the text of a PDF by hand...

If you, like me, resent every dollar spent on commercial PDF tools, you might want to know how to change the text content of a PDF without having to pay for Adobe Acrobat or another PDF tool. I didn't see an obvious open-source tool that lets you dig into PDF internals, but I did discover a few useful facts about how PDFs are structured that I think may prove useful to others (or myself) in the future. They are recorded here. They are surely not universally applicable --
the PDF standard is truly Byzantine -- but they worked for my case.

Angola
Botswana
Egypt
Eritrea
Eswatini, Kingdom of
Ethiopia
Gambia, Republic of the
Ghana
Kenya
Lesotho
# create figure form matplotlib.pyplot
fig = plt.figure()
# make global min/max for the whole array,
# so colour scale will be consistent between the frames
data_min = np.nanmin(full_data_panel.values)
data_max = np.nanmax(full_data_panel.values)
# create iterator
data_frames_iterator = full_data_panel.iteritems()

Keybase proof

I hereby claim:

  • I am louispotok on github.
  • I am potok (https://keybase.io/potok) on keybase.
  • I have a public key ASCGNBKM1z8rYrsg75rBrsj7h7A90IwtA0D8M4M5YVqDhAo

To claim this, I am signing this object: