Skip to content

Instantly share code, notes, and snippets.

@jurand71
Created November 23, 2022 11:34
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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