Navigation X
ALERT
Click here to register with a few steps and explore all our cool stuff we have to offer!



   266

Please anyone volunteer - by creating a script which will remove Text from PDFs!

by tom_mabe - 07 December, 2024 - 01:34 PM
This post is by a banned member (tom_mabe) - Unhide
tom_mabe  
Registered
3
Posts
3
Threads
#1
(This post was last modified: 07 December, 2024 - 04:15 PM by tom_mabe.)
Can anyone volunteer helping me creating a simple script? i have $5 remaining after getting scammed by many people. So i need your expertise and help! 
Can you develop a python script which will erase or remove specific text from pdfs. a Simple script. i tried but the pdfs  does not format after removing the text in right order! 
If anyone Could help me i will highly appreciate it. PM me your TG please! 


Please anyone help me. i don't have much money to spend on marketplace but i need it urgent.. Guy anyone volunteer?

Anyone interested to help me?
This post is by a banned member (Shroomiee) - Unhide
Shroomiee  
Infinity
7
Posts
0
Threads
#2
msg me on tele we can work it out, sounds easy i can start working on it now @Doomsday223 or @stealthlabs
This post is by a banned member (kebisoc775) - Unhide
112
Posts
0
Threads
1 Year of service
#3
Code:
 
from PyPDF2 import PdfReader, PdfWriter

def remove_text_from_pdf(input_pdf, output_pdf, text_to_remove):
    # Open the input PDF
    reader = PdfReader(input_pdf)
    writer = PdfWriter()

    for page in reader.pages:
        # Extract the text from the page
        content = page.extract_text()
        if content:
            # Replace the unwanted text
            modified_content = content.replace(text_to_remove, "")
            
            # Add modified content to a new page
            page.clear_content()  # Remove existing content
            page.add_text(modified_content)  # Add modified content
        writer.add_page(page)

    # Write the modified content to a new PDF
    with open(output_pdf, "wb") as output_file:
        writer.write(output_file)

# Example usage
input_pdf_path = "example.pdf"
output_pdf_path = "modified_example.pdf"
text_to_remove = "Text to remove"

remove_text_from_pdf(input_pdf_path, output_pdf_path, text_to_remove)

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
or
Sign in
Already have an account? Sign in here.


Forum Jump:


Users browsing this thread: 2 Guest(s)