PDF copy some seal image disappear #1238
-
Please provide all mandatory information! Describe the bug (mandatory)when I copy some pdf use issue 722 demo function, and the output pdf not found some seal images. To Reproduce (mandatory)the old pdf: the right side two red seal images disappear demo code:
Expected behavior (optional)the red images is pdf sign seal image, I hope keep the images at the same location,the sign info remove is ok, I don't care. Screenshots (optional)not found the red seal images at the right side. Your configuration (mandatory)windows 10 64bit Additional context (optional)Add any other context about the problem here. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Thank you for submitting this. This is not a bug - it works as designed.
There is a solution for your case however: import fitz
import sys
src = fitz.open(sys.argv[1]) # input file
srcbytes = src.convert_to_pdf() # convert to a new PDF
src.close()
src = fitz.open("pdf", srcbytes) # open converted as PDF
spage = src[0]
oldrot = spage.rotation
spage.set_rotation(0)
doc = fitz.open()
npage = doc.new_page(width=spage.rect.width, height=spage.rect.height)
npage.show_pdf_page(
npage.rect,
src,
0,
)
npage.set_rotation(oldrot)
doc.ez_save(__file__.replace(".py", ".pdf")) |
Beta Was this translation helpful? Give feedback.
Thank you for submitting this. This is not a bug - it works as designed.
show_pdf_page()
cannot copy annotations of the source page.There is a solution for your case however:
You can convert the source PDF to a new PDF. The underlying MuPDF function converts annotations to normal page content.
Then use the resulting PDF as your source.
You should now see annotation images in the target, but they technically are no longer annotations (or widgets, signatures, etc.).
Here is a snippe…