some feature requests
Hello there, I'd want to express my gratitude for this fantastic repository. I'd been looking for a dependable watermarker for PDF files but hadn't been able to find one. This app is fantastic. There is no way to get rid of the watermark on the internet. btw, I'd want to make some feature requests.
1- convert entire pages of a pdf to picture files 2- the ability to transfer the watermark to different portions of the page using the mouse pointer or by specifying an X,Y location.
best
Thanks for your interest!
For the feature 1, I recently have no plan to add it to this application but I think the following script will help:
import os
import fitz
from fitz import TOOLS
from fitz.utils import get_pixmap
def save_all_page_to_img(file: str, dir: str, alpha: bool = True) -> None:
"""
:param file: pdf file name
:param dir: where to store the images
:param alpha: whether to include alpha channel
"""
if not os.path.exists(dir):
os.makedirs(dir)
doc = fitz.open(file)
n_pages = doc.page_count
for idx in range(n_pages):
pix = get_pixmap(
doc[idx],
dpi=220,
alpha=alpha,
)
file_name = os.path.join(
dir, (os.path.basename(file).replace(".pdf", "") + f"-{idx}.png")
)
pix.save(filename=file_name)
print(f"Saved to {file_name}")
TOOLS.store_shrink(100) # delete MuPDF cache
if __name__ == "__main__":
save_all_page_to_img(r"your_file.pdf", r"your_target_dir")
For the second feature, I have made an update (versoin 2.2.4) that includes it. Now right click the page at watermark tab you can find a new option. I will upload this version to PyPI soon.
i appreciate your time and effort
best
Hi, if everything is okey, I will close this issure.
sure you can do it thanks again