Guest User

zal upa

a guest
Oct 23rd, 2019
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. #!/usr/bin/python3
  2. # -*- coding: utf-8 -*-
  3.  
  4. import sys
  5. import fitz
  6. import tkinter
  7. import os
  8.  
  9. from tkinter import filedialog as fd
  10.  
  11. filename = fd.askopenfilename()
  12. pdf_document = fitz.open(filename)
  13. terms = ["СМЕТА", "ВЕДОМОСТЬ"]
  14. with open("outdata.txt", "w") as outputFile:
  15.     for current_page in range(len(pdf_document)):
  16.         page = pdf_document.loadPage(current_page)
  17.         for x in terms:
  18.             if page.searchFor(x):
  19.                 print("%s found on page %i" % (x, current_page))
  20.                 print("%s found on page %i" % (x, current_page), file=outputFile)
  21.     os.system('outdata.txt')
Advertisement
Add Comment
Please, Sign In to add comment