Created
May 3, 2010 16:04
-
-
Save seyyah/388237 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
"""\ | |
pdfnot input.pdf output.pdf bos.pdf | |
input'un her sayfasinin ardina bos'u ekleyerek output'u elde et | |
""" | |
import sys | |
import os | |
from pyPdf import PdfFileWriter, PdfFileReader | |
def main(argv): | |
tmpfile = "temp.pdf" | |
inpfile = argv[0] | |
if len(argv) > 1: | |
outfile = argv[1] | |
else: | |
basename, extension = os.path.splitext(inpfile) | |
outfile = basename + '_not' + extension | |
if len(argv) > 2: | |
bosfile = argv[2] | |
else: | |
bosfile = "bos.pdf" | |
output = PdfFileWriter() | |
input1 = PdfFileReader(file(inpfile, "rb")) | |
input2 = PdfFileReader(file(bosfile, "rb")) | |
numpg = input1.getNumPages() | |
for p in range(numpg): | |
output.addPage(input1.getPage(p)) | |
output.addPage(input2.getPage(0)) | |
# finally, write "output" to document-output.pdf | |
outputStream = file(tmpfile, "wb") | |
output.write(outputStream) | |
outputStream.close() | |
os.system('pdfnup --nup 2x3 --offset "50 20" --outfile ' + outfile + ' ' + tmpfile) | |
#os.system('pdfnup --nup 2x3 --offset "50 20" --outfile ' + tmpfile + ' ' + tmpfile) | |
#os.system('pdfnup --nup 2x1 --outfile ' + outfile + ' ' + tmpfile) | |
os.remove(tmpfile) | |
if __name__ == '__main__': | |
main(sys.argv[1:]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment