I am trying to write a python script which will read 2 pdf file and combine it to a new file but when i'm running the code below i'm not able to get desired please help
pdf1=open('1.pdf', 'rb')
pdf2=open('2.pdf', 'rb')
pdf3=open('new.pdf','ab')
chunk =200
while True:
data=pdf1.read(chunk)
if not data:
break
pdf3.write(data)
while True:
data=pdf2.read(chunk)
if not data:
break
pdf3.write(data)
pdf1.close()
pdf2.close()
pdf3.close()