Merge two pages to one #1130
Unanswered
aashishvanand
asked this question in
Looking for help
Replies: 2 comments 7 replies
-
There is method page.show_pdf_page(rect, docsrc, pno=0, keep_proportion=True, overlay=True, oc=0, rotate=0, clip=None) |
Beta Was this translation helpful? Give feedback.
3 replies
-
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I have a Digitally signed pdf (PAdES) signed by user 1. There is a situation where I need to add some basic annotation and do an incremental save (so that I don't lose the 1st signature) and sign the same pdf with user 2 digital signature.
I have the signed pdf and separate pdf with all the annotations at the correct place. Assuming both the pdf page size is the same is it possible to merge the two pages into one.
I am aware of the insert page in Fitz but I am looking for a merge page function rather than insert
import fitz
doc1 = fitz.open("sample1_signed.pdf")
doc2 = fitz.open("sample2_annotation.pdf")
doc2.insertPDF(doc1)
doc2.save("document-Signed.pdf", incremental=True, encryption=fitz.PDF_ENCRYPT_KEEP)
I am looking for something that is equivalent to PyPDF2 mergePage function PyPDF2. Unfortunately PyPDF2 does not support incremental updates.
from PyPDF2 import PdfFileMerger, PdfFileReader, PdfFileWriter
file1 = PdfFileReader(open("sample1_signed.pdf", "rb"))
file2 = PdfFileReader(open("sample2_annotations.pdf", "rb"))
output = PdfFileWriter()
page = file1.getPage(0)
page.mergePage(file2.getPage(0))
output.addPage(page)
outputStream = open("document-output.pdf", "wb")
output.write(outputStream)
outputStream.close()
Beta Was this translation helpful? Give feedback.
All reactions