Skip to content

Instantly share code, notes, and snippets.

View wtfcarlos's full-sized avatar
🍀
Fortunatissimo per verità

Carlos Rey wtfcarlos

🍀
Fortunatissimo per verità
View GitHub Profile
@wtfcarlos
wtfcarlos / compress.py
Created September 22, 2023 23:04
Carlos PDF Compressor
import PyPDF2
def compress_pdf(input_path, output_path):
with open(input_path, 'rb') as input_pdf:
reader = PyPDF2.PdfReader(input_pdf)
writer = PyPDF2.PdfWriter()
for page_num in range(len(reader.pages)):
page = reader.pages[page_num]
writer.add_page(page)