Last active
May 13, 2020 19:32
-
-
Save shubhamagarwal92/1d446b92dda996e413bc83697fff8278 to your computer and use it in GitHub Desktop.
combine pdfs
This file contains hidden or 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
# https://cmdlinetips.com/2016/03/how-to-join-pdf-files-in-mac-on-terminal/ | |
# On mac | |
/System/Library/Automator/Combine\ PDF\ Pages.action/Contents/Resources/join.py -o pages.pdf 1.pdf 2.pdf | |
# Another command | |
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=combine.pdf -dBATCH 1.pdf 2.pdf | |
# sed 's/>>> //g ' combinePDF.py >> combinePDF.py | |
# For specific pages python command | |
# from PyPDF2 import PdfFileReader | |
# from PyPDF2 import PdfFileWriter | |
# file1= open('ds7002.pdf','rb') | |
# pdf1 = PdfFileReader(file1) | |
# newFile = 'newFile.pdf' | |
# writer = PdfFileWriter() | |
# writer.addPage(pdf1.getPage(0)) | |
# file2 = open('out.pdf','rb') | |
# pdf2=PdfFileReader(file2) | |
# writer.addPage(pdf2.getPage(1)) | |
# writer.addPage(pdf2.getPage(2)) | |
# writer.addPage(pdf2.getPage(3)) | |
# writer.addPage(pdf2.getPage(4)) | |
# newPdf = open(newFile,'wb') | |
# writer.write(newPdf) | |
# newPdf.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment