1
0
mirror of https://github.com/kanzure/pdfparanoia.git synced 2024-06-12 13:49:51 +02:00
pdfparanoia/bin/pdfparanoia

38 lines
840 B
Plaintext
Raw Normal View History

2013-02-09 16:43:12 +01:00
#!/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 = False
while '--verbose' in sys.argv:
verbose = True
sys.argv.pop(sys.argv.index('--verbose'))
while '-v' in sys.argv:
verbose = True
sys.argv.pop(sys.argv.index('-v'))
2013-02-09 16:43:12 +01:00
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)
2013-02-09 16:43:12 +01:00
# dump to output
sys.stdout.write(output)