Skip to content
This repository has been archived by the owner on Dec 31, 2021. It is now read-only.

Commit

Permalink
close #22 add color line pdfid window
Browse files Browse the repository at this point in the history
  • Loading branch information
tkmru committed Mar 2, 2016
1 parent f91a138 commit 8a9f1a2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions detail_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def __init__(self, *args, **kwags):

self.signature_textctrl = wx.TextCtrl(self, -1, style=wx.TE_READONLY | wx.TE_MULTILINE)
self.strings_textctrl = wx.TextCtrl(self, -1, style=wx.TE_READONLY | wx.TE_MULTILINE)
self.pdfid_textctrl = wx.TextCtrl(self, -1, style=wx.TE_READONLY | wx.TE_MULTILINE)
self.pdfid_textctrl = wx.TextCtrl(self, -1, style=wx.TE_READONLY | wx.TE_MULTILINE | wx.TE_RICH2)
self.pdf_parse_textctrl = wx.TextCtrl(self, -1, style=wx.TE_READONLY | wx.TE_MULTILINE)

self.InsertPage(0, self.signature_textctrl, "signature")
Expand Down Expand Up @@ -43,8 +43,10 @@ def display_signature(self, header_indexies, footer_indexies):
self.signature_textctrl.AppendText(key + ': ' + str(len(footer_indexies[key])) + 'signature\n')

def display_pdfid(self, file_path):
pdfid = get_pdfid_value(file_path)
self.pdfid_textctrl.AppendText(pdfid)
for i, pdfid in enumerate(get_pdfid_value(file_path)):
self.pdfid_textctrl.AppendText(pdfid)
if pdfid.startswith('/JS') or pdfid.startswith('/JavaScript') or pdfid.startswith('/ObjStm'):
self.pdfid_textctrl.SetStyle(21*(i-1), 21*i, wx.TextAttr("RED", "White"))

def display_pdfparse(self, file_path):
result = subprocess.check_output(['python', 'pdf-parser.py', '--filter', '--raw', file_path])
Expand All @@ -60,11 +62,9 @@ def display_pdfparse(self, file_path):
def get_pdfid_value(filename):
xmlDoc = pdfidlib.PDFiD(filename)
header = 'PDF Header: {0}\n'.format(xmlDoc.documentElement.getAttribute('Header'))
pdfid = ''
yield header
for node in xmlDoc.documentElement.getElementsByTagName('Keywords')[0].childNodes:
pdfid += '{0:<10}{1: 5d}\n'.format(node.getAttribute('Name'), int(node.getAttribute('Count')))

return header + pdfid
yield '{0: <15}{1: 5d}\n'.format(node.getAttribute('Name'), int(node.getAttribute('Count')))


def strings(filename, min=4):
Expand Down

0 comments on commit 8a9f1a2

Please sign in to comment.