Skip to content

Instantly share code, notes, and snippets.

@jurand71
Created November 23, 2022 11:34
Show Gist options
  • Save jurand71/862d078cfe24f2d68dcafd869e21ba36 to your computer and use it in GitHub Desktop.
Save jurand71/862d078cfe24f2d68dcafd869e21ba36 to your computer and use it in GitHub Desktop.
import pandas as pd
import PyPDF2
from PyPDF2 import PdfReader
reader = PdfReader("mapa_zawartosci_opad.pdf")
parts = []
def visitor_body(text, cm, tm, fontDict, fontSize):
x = tm[4]
y = tm[5]
if y < 530 and x < 350:
parts.append(text)
for page in reader.pages:
page.extract_text(visitor_text=visitor_body)
text_body = "".join(parts)
f = open('stacje_meteo_opad.csv','w')
f.write(text_body)
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment