Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python3
- # -*- coding: utf-8 -*-
- import sys
- import fitz
- import tkinter
- import os
- from tkinter import filedialog as fd
- filename = fd.askopenfilename()
- pdf_document = fitz.open(filename)
- terms = ["СМЕТА", "ВЕДОМОСТЬ"]
- with open("outdata.txt", "w") as outputFile:
- for current_page in range(len(pdf_document)):
- page = pdf_document.loadPage(current_page)
- for x in terms:
- if page.searchFor(x):
- print("%s found on page %i" % (x, current_page))
- print("%s found on page %i" % (x, current_page), file=outputFile)
- os.system('outdata.txt')
Advertisement
Add Comment
Please, Sign In to add comment