Skip to content Skip to sidebar Skip to footer

Embed One Pdf Into Another Pdf Using Pymupdf

In need of help from learned people on this forum. I just want to embed one pdf file to another pdf file. So that when I go to the attachment section of the second file I can get t

Solution 1:

Just Soved it with this code:

import fitz
pdf1=r'C:\Users\Amit PC\Desktop\pdf1.pdf'
pdf2=r'C:\Users\Amit PC\Desktop\pdf2.pdf'
outfile=r'C:\Users\Amit PC\Desktop\test2.pdf'
img= bytearray(open(pdf2,'rb').read())
doc1=fitz.open(pdf1)
doc1.embeddedFileAdd(img,'attach.pdf')
doc1.save(outfile, deflate = True)
doc1.close()

Post a Comment for "Embed One Pdf Into Another Pdf Using Pymupdf"