summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2012-09-16 22:35:51 +0200
committerFlorian Bruhin <git@the-compiler.org>2012-09-16 22:35:51 +0200
commiteda286f01cb0d4d9639658232fd32b4d90db694f (patch)
tree0e423200f28fffc208735e6138b6e66081fb368c
parent3fc92ec5e3e4338097c75839fd9a94245bb93ce3 (diff)
downloadxojgrep-eda286f01cb0d4d9639658232fd32b4d90db694f.tar.gz
xojgrep-eda286f01cb0d4d9639658232fd32b4d90db694f.zip
Add getcontent() for PDFFile
-rw-r--r--xojgrep.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/xojgrep.py b/xojgrep.py
index 4c489f4..1b615f3 100644
--- a/xojgrep.py
+++ b/xojgrep.py
@@ -108,7 +108,14 @@ class PDFFile:
self.pdffile.close()
def getcontent(self):
-
+ pagecount = self.doc.numPages
+ content = []
+ for pn in range(1, pagecount + 1):
+ page = self.doc.getPage(pn)
+ text = page.extractText()
+ if text:
+ content.append((pn, [text]))
+ return content
if __name__ == '__main__':
sys.exit(main())