Download pool/shard004/Python/0035826_watermark.py from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 659 Bytes
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard004/Python/0035826_watermark.py
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/pool/shard004/Python/0035826_watermark.py
-
curl -L -o 0035826_watermark.py https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard004/Python/0035826_watermark.py
659 Bytes
| from pyPdf import PdfFileWriter, PdfFileReader | |
| output = PdfFileWriter() | |
| input1 = PdfFileReader(file("doc/document.pdf", "rb")) | |
| # print the title of document1.pdf | |
| print "title = %s" % (input1.getDocumentInfo().title) | |
| for i in range(0, input1.getNumPages()): | |
| page = input1.getPage(i) | |
| watermark = PdfFileReader(file("doc/watermark.pdf", "rb")) | |
| page.mergePage(watermark.getPage(0)) | |
| output.addPage(page) | |
| # print how many pages input1 has: | |
| print "document.pdf has %s pages." % input1.getNumPages() | |
| # finally, write "output" to document-output.pdf | |
| outputStream = file("document-output.pdf", "wb") | |
| output.write(outputStream) | |
| outputStream.close() | |