aboutsummaryrefslogtreecommitdiffstats
path: root/parsepdftext.py
diff options
context:
space:
mode:
Diffstat (limited to 'parsepdftext.py')
-rw-r--r--parsepdftext.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/parsepdftext.py b/parsepdftext.py
new file mode 100644
index 0000000..778d30b
--- /dev/null
+++ b/parsepdftext.py
@@ -0,0 +1,10 @@
+import sys
+from xml.etree import ElementTree as ET
+
+document = ET.parse(sys.argv[1])
+ns = 'http://www.w3.org/1999/xhtml'
+for page, i in enumerate(document.findall('.//{{{0}}}page'.format(ns))):
+ for word in page.getchildren():
+ octalescapedtext = ''.join(["\{0:o}".format(c) if c>127 else chr(c) for c in map(ord,word.text.encode('utf8'))])
+ #escape quote character
+ print octalescapedtext