-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
When using page.merge_page(wmPage, over=True)
to apply a stamp, the stamp is scaled
Environment
Windows 10 x64, Python 3.10 x64
$ python -m platform
Windows-10-10.0.19045-SP0
$ python -c "import pypdf;print(pypdf._debug_versions)"
pypdf==3.16.2, crypt_provider=('local_crypt_fallback', '0.0.0'), PIL=9.0.1
Code
from pypdf import PdfWriter, PdfReader, Transformation
from os import remove as fileDelete
import os.path
OUT_PATH = r"TMP_OUT.pdf" #Path
SRC_PAGE = r"PAGE.pdf"
WM_PAGE = r"PDF_WATERMARK.pdf"
if __name__=="__main__":
pdfOut = PdfWriter() #Blank writer
pdfOut.append(SRC_PAGE)
wmPage = PdfReader(WM_PAGE).pages[0]
for page in pdfOut.pages:
page.merge_page(wmPage, over=True) #False (watermark does not seem to mirror.)
if os.path.exists(OUT_PATH):
fileDelete(OUT_PATH)
pdfOut.write(OUT_PATH)
pdfOut.close()
Problems
I've not fully diagnosed, but it looks like if the WM_PAGE
is a different resolution (DPI) then it appears at a different scaling. This is perhaps less of an issue, but would appreciate some tips to correct it.
Metadata
Metadata
Assignees
Labels
No labels