Skip to content

Commit

Permalink
Add helpful print output and adjust width of page
Browse files Browse the repository at this point in the history
  • Loading branch information
averagewagon committed Jun 29, 2024
1 parent ac23358 commit 67836f6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
Binary file modified docs/Jonathan_Hendrickson_resume.pdf
Binary file not shown.
4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
font:
1.1em "Times New Roman",
serif;
line-height: 1.5000000000000002;
line-height: 1.5;
margin: 40px 0;
}

#resume {
margin: 0 auto;
max-width: 800px;
max-width: 900px;
padding: 40px 60px;
background: #fff;
border: 1px solid #ccc;
Expand Down
8 changes: 8 additions & 0 deletions generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,14 @@ def adjust_css(css_content: str, line_height: float) -> str:
output_html = os.path.join(output_dir, args.output_html)
output_pdf = os.path.join(output_dir, args.output_pdf)

print("Reading input Markdown file...")
with open(args.input_md, encoding="utf-8") as mdfp:
md_content = mdfp.read()

print("Checking spelling in the Markdown content...")
check_spelling(md_content, args.input_dictionary)

print("Reading CSS file...")
with open(args.input_css, encoding="utf-8") as cssfp:
css_content = cssfp.read()

Expand All @@ -211,6 +214,8 @@ def adjust_css(css_content: str, line_height: float) -> str:
first_iteration = True

while True:
line_height = round(line_height, 2) # Round to two decimal places
print(f"Adjusting CSS line height to {line_height}...")
adjusted_css = adjust_css(css_content, line_height)
html_content = make_html(md_content, adjusted_css)

Expand All @@ -228,13 +233,16 @@ def adjust_css(css_content: str, line_height: float) -> str:
first_iteration = False

if num_pages > 1:
print("Content exceeds one page, reverting to previous line height...")
# If the content spills over to more than one page, revert to previous settings
adjusted_css = adjust_css(css_content, prev_line_height)
html_content = make_html(md_content, adjusted_css)

print("Writing HTML content to file with reverted line height...")
with open(output_html, "w", encoding="utf-8") as htmlfp:
htmlfp.write(html_content)

print("Generating final PDF with reverted line height...")
write_pdf(html_content, output_pdf, args.chrome_path)
break

Expand Down
2 changes: 1 addition & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ body {

#resume {
margin: 0 auto;
max-width: 800px;
max-width: 900px;
padding: 40px 60px;
background: #fff;
border: 1px solid #ccc;
Expand Down

0 comments on commit 67836f6

Please sign in to comment.