Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/env python
- """ attribution to book violent python. this is supposed to print meta to stdout, it doesn't.
- it doesn't throw exception, but doesn't print anything. still working on it."""
- import pyPdf
- import optparse
- from pyPdf import PdfFileReader
- def printmeta(filename):
- pdfFile = PdfFileReader(file(filename, 'rb'))
- docInfo = pdfFile.getDocumentInfo()
- print '[*] PDF MetaData For: ' + str(filename)
- for metaItem in docInfo:
- print '[+] ' + metaItem + ':' + docInfo[metaItem]
- def main():
- parser = optparse.OptionParser('usage %prog "+\
- "-F <PDF file name>')
- parser.add_option('-F', dest='fileName', type='string',\
- help='specify PDF file name')
- (options, args) = parser.parse_args()
- fileName = options.fileName
- if fileName == None:
- print parser.usage
- exit(0)
- else:
- printMeta(fileName)
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement