This is Pdf in Write a Name -Dr kuldeep Saini fo all page
Create a Python script and execute it to add "Dr. Kuldeep Saini" as a header/watermark to a PDF file. The task: 1. First check if reportlab and pypdf (or PyPDF2) are available: run `pip list` or check imports 2. The input PDF content has been provided as text (29 pages of Biomechanics & Kinesiology content). Since the actual PDF file is not on disk, you need to CREATE a new PDF that adds "Dr. Kuldeep Saini" as a prominent header on every page. 3. Use the pypdf library (or reportlab) to create a watermark/overlay PDF that adds the text "Dr. Kuldeep Saini" to each page. Here's exactly what to do: - Check what PDF libraries are available (pypdf, PyPDF2, reportlab, fitz/pymupdf) - The source PDF is uploaded by the user but may not be on disk. Check /tmp/ and common upload locations for any PDF files. - If found, use the available library to add "Dr. Kuldeep Saini" as a header (top center or top right) on every page - Save the output to /tmp/kuldeep_saini_output.pdf If no PDF file is found on disk, create a Python script that: 1. Uses reportlab to create a simple overlay 2. Write the script to /tmp/add_watermark.py 3. Provide clear instructions Check these locations for PDF files: - /tmp/ - /home/ - /root/ - /uploads/ - current directory Report back: 1. What PDF libraries are available 2. Whether the source PDF was found and where 3. The full Python script used 4. Whether the output was successfully created at /tmp/kuldeep_saini_output.pdf 5. Any errors encountered
add_name.py and run it:import fitz # pip install pymupdf
doc = fitz.open("your_file.pdf") # replace with your filename
for page in doc:
rect = page.rect
# Add name at top center of every page
page.insert_text(
point=(rect.width / 2 - 60, 30), # top center position
text="Dr. Kuldeep Saini",
fontsize=14,
fontname="helv",
color=(0.1, 0.1, 0.6), # dark blue color
)
doc.save("kuldeep_saini_output.pdf")
print("Done! Saved as kuldeep_saini_output.pdf")
pip install pymupdf