|
@@ -1,6 +1,7 @@
|
|
|
import PyPDF2
|
|
|
import plac
|
|
|
from pathlib import Path
|
|
|
+from doc2pdf import doc2pdf
|
|
|
|
|
|
|
|
|
def add_watermark(input_file):
|
|
@@ -38,11 +39,14 @@ def add_watermark(input_file):
|
|
|
|
|
|
|
|
|
def add_watermark_to_folder(base_dir):
|
|
|
+ for filename in Path(base_dir).glob('*.doc'):
|
|
|
+ doc2pdf(str(filename))
|
|
|
+
|
|
|
for filename in Path(base_dir).glob('*.pdf'):
|
|
|
add_watermark(str(filename))
|
|
|
print(filename.name)
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
- plac.call(add_watermark_to_folder)
|
|
|
- # add_watermark_to_folder(os.path.dirname(__file__) + '/data/')
|
|
|
+ # plac.call(add_watermark_to_folder)
|
|
|
+ add_watermark_to_folder(str(Path(__file__).parent) + '/data/')
|