V2: Added Webserver for faster formatting

This commit is contained in:
Media
2026-07-25 15:13:23 -05:00
parent eed911cffa
commit 3eab672c6c
22 changed files with 3737 additions and 128 deletions
+9 -4
View File
@@ -1,10 +1,10 @@
import fitz # PyMuPDF
LETTER_WIDTH = 792 # 8.5 inches
LETTER_HEIGHT = 612 # 11 inches
LETTER_WIDTH = 792 # 11 inches at 72 points per inch
LETTER_HEIGHT = 612 # 8.5 inches at 72 points per inch
BOTTOM_MARGIN = 60
def adjust_layout(input_path, output_path, shift_amount):
def adjust_layout(input_path, output_path, shift_amount, bottom_margin=BOTTOM_MARGIN):
doc = fitz.open(input_path)
new_doc = fitz.open()
@@ -17,7 +17,12 @@ def adjust_layout(input_path, output_path, shift_amount):
# Shift original content down by shift_amount
# Clip it back to fit on a Letter-sized page
content_rect = fitz.Rect(0, shift_amount, rect.width, rect.height + shift_amount - BOTTOM_MARGIN)
content_rect = fitz.Rect(
0,
shift_amount,
rect.width,
rect.height + shift_amount - bottom_margin,
)
new_page.show_pdf_page(content_rect, doc, page.number)