This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"theme": "dark", | |
"themeVariables": { | |
"git0": "#aa00aa", | |
"git1": "#aa0000", | |
"git2": "#bb7700", | |
"git3": "#00aa00", | |
"git4": "#0055aa", | |
"git5": "#0077aa", | |
"git6": "#0088aa", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import PyPDF2 | |
def merge_pdfs(input_directory, output_file): | |
# Create a PDF merger object | |
merger = PyPDF2.PdfMerger() | |
# Get a sorted list of all PDF files in the directory | |
pdf_files = sorted([f for f in os.listdir(input_directory) if f.lower().endswith('.pdf')]) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import PyPDF2 | |
def get_pdf_size(pdf_writer): | |
"""Estimate the size of the PDF by writing it to a temporary file.""" | |
import io | |
temp_stream = io.BytesIO() | |
pdf_writer.write(temp_stream) | |
return temp_stream.tell() / (1024 * 1024) # Convert bytes to MB |
OlderNewer