1
0
mirror of https://github.com/kanzure/pdfparanoia.git synced 2024-06-10 12:49:52 +02:00
pdfparanoia/bin/pdfparanoia
Zooko O'Whielacronx 503b8aead5 add -v -v mode which prints out the details (potentially sensitive, potentially bulky)
remove spie, which appears to do nothing
2013-02-13 21:08:49 +00:00

38 lines
832 B
Python
Executable File

#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
"""
pdfparanoia - pdf watermark removal tool
This is the command-line client. It accepts pdf formatted data either through
stdin/piping or by referencing a file in argv[0].
"""
if __name__ == "__main__":
import sys
import fileinput
from StringIO import StringIO
verbose = 0
while '--verbose' in sys.argv:
verbose += 1
sys.argv.pop(sys.argv.index('--verbose'))
while '-v' in sys.argv:
verbose += 1
sys.argv.pop(sys.argv.index('-v'))
import pdfparanoia
# read in all lines
content = ""
for line in fileinput.input():
content += line
# scrub the pdf to get rid of watermarks
output = pdfparanoia.scrub(StringIO(content), verbose=verbose)
# dump to output
sys.stdout.write(output)