Just Soved it with this code:
import fitz
pdf1=r'C:UsersAmit PCDesktoppdf1.pdf'
pdf2=r'C:UsersAmit PCDesktoppdf2.pdf'
outfile=r'C:UsersAmit PCDesktop est2.pdf'
img= bytearray(open(pdf2,'rb').read())
doc1=fitz.open(pdf1)
doc1.embeddedFileAdd(img,'attach.pdf')
doc1.save(outfile, deflate = True)
doc1.close()
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…