🏛️ Academic Document Generator
Born from frustration with proprietary tools and complex LaTeX workflows, this converter was built as a completely independent solution. No Microsoft dependencies, no complex LaTeX installations - just pure Python-powered document generation.
The Markdown PDF Generator revolutionizes academic document creation through intelligent 2-Pass PDF Generation and seamless YAML Front Matter Integration.
🎯 Use Case
📋 Master Thesis Proposals
All document metadata in one place
HHN branding and professional layout
Digital signature fields for all participants
University-compliant styling and logos
💡 Professional academic documents only with markdown
🏗️ Architecture & Design
📁 Modular Structure
hhn_pdf_generator/
├── core/
│ ├── generator.py # Main PDF Generator - Core conversion engine orchestrating Markdown to PDF
│ ├── styles.py # Dynamic Styling - CSS-like formatting, fonts, colors, layouts
│ ├── config.py # Configuration - Centralized document settings and user preferences
│ └── template.py # Custom Document Template - Page layouts, headers, footers, structure
├── generators/
│ ├── title_page.py # Title Page Generator - Automated creation with metadata and branding
│ ├── toc.py # Table of Contents Generator - Intelligent heading extraction and navigation
│ └── signature.py # Signature Generator - Digital signatures and document authentication
├── utils/
│ ├── yaml_parser.py # YAML Front Matter Parser - Metadata and configuration extraction
│ ├── markdown_parser.py # Markdown Content Parser - Extended syntax and content preprocessing
│ ├── logo_handler.py # Logo Management - Image embedding, resizing, institutional branding
│ └── page_tracker.py # Page Number Tracking - Accurate cross-references and numbering
└── main.py # CLI Entry Point - Command-line interface for document conversion
PDF Engine
Front Matter
Core Language
Input Format
✨ Key Features
🔄 2-Pass PDF Generation
Innovative 2-Pass Generation for exact page numbers in table of contents.
def generate_pdf(self, input_file, output_file=None):
# First pass: Page number tracking
doc = PageTrackingDocTemplate(temp_output)
story = self._build_story_first_pass(styles, content, doc)
doc.build(story)
# Second pass: Final PDF with accurate TOC
page_tracker = doc.get_page_tracker()
toc_generator.set_actual_page_numbers(page_tracker)
doc_final.build(story_final)
📋 YAML Front Matter
Intelligent configuration via YAML Header for flexible document creation.
---
student:
name: "Marc Nauendorf"
student_id: "200882"
program: "Software Engineering Master"
supervisor: "Prof. Dr. supervisor"
document:
type: "Master Thesis Proposal"
submission_date: "November 2025"
flags:
toc_on_table_page: true
signature_line: true
supervisor_signature: true
---
📊 Advanced Features
🔗 Interactive Table of Contents
Intelligent table of contents with clickable links and automatically generated page numbers through innovative 2-pass processing.
def create_table_of_contents(self):
# First pass: Collect headings
for item in self.toc_items:
anchor = create_anchor_name(item['text'])
page = self.get_actual_page(anchor)
# Create clickable links
link = f'<a href="#{anchor}">{item["text"]}</a>'
dots = "." * (50 - len(item["text"]))
story.append(Paragraph(f'{link}{dots}{page}'))
✍️ Signature System
Intelligent creation of signature fields for all participants with flexible arrangement and HHN standards.
class SignatureGenerator:
def create_signatures(self, yaml_data):
signatures = []
# Student Signature (always)
signatures.append(self.create_student_sig())
# Supervisor Signatures (configurable)
if yaml_data.get('supervisor'):
signatures.append(self.create_supervisor_sig())
return Table(signatures, style=self.signature_style)
🏛️ Logo Integration
Automatic download and integration of university logos with intelligent fallback system.
class LogoHandler:
def setup_branding(self):
# Download HHN Logo
hhn_logo = self.download_hhn_logo()
# Download UniTyLab Logo
lab_logo = self.download_unitylab_logo()
# Fallback to text headers
if not (hhn_logo and lab_logo):
return self.create_text_headers()
return self.create_logo_headers(hhn_logo, lab_logo)
💡 All features work seamlessly together for fully automated, professional PDF creation
🎨 Extended Features
✨ Rich Markdown Formatting
Full support for extended Markdown syntax with intelligent PDF rendering and professional typography.
📝 Text Styling
Professional text formatting with automatic typography:
- *Italic text* - Elegant emphasis
- **Bold text** - Strong highlighting
`Code snippets`- Inline code
💬 Quote Blocks
Intelligent quote rendering with proper indentation:
> Quote blocks with automatic styling and professional formatting
📋 Smart Lists
Automatic list formatting with proper spacing and numbering:
- Automatic numbering
- Professional spacing
- Consistent formatting
- Clean bullet points
- Proper indentation
- Academic standards
class MarkdownRenderer:
def render_text_formatting(self, text):
# Italic text processing
text = re.sub(r'\*(.*?)\*', r'<i>\1</i>', text)
# Bold text processing
text = re.sub(r'\*\*(.*?)\*\*', r'<b>\1</b>', text)
# Code formatting
text = re.sub(r'`(.*?)`', r'<font name="Courier">\1</font>', text)
return text
def render_quotes(self, content):
# Professional quote block styling
quote_style = ParagraphStyle(
'Quote',
leftIndent=20,
rightIndent=20,
borderLeft=2,
borderColor=colors.HexColor('#81c784')
)
return Paragraph(content, quote_style)
🔧 Usage & Integration
$ Terminal Commands
# Simple conversion
python main.py proposal.md
# With output path
python main.py thesis.md -o custom_thesis.pdf
# Batch conversion (Windows)
./convert_all.bat
Drag & Drop Markdown file
Dependencies handled automatically
Windows, Linux, macOS
⚡ Automatic Dependency Installation
The generator automatically checks and installs all required Python packages via intelligent startup script:
🚀 Smart Startup Process
def check_and_install_dependencies():
required_packages = ['reportlab', 'PyYAML', 'Pillow', 'requests']
for package in required_packages:
try:
__import__(package)
print(f"✅ {package} already installed")
except ImportError:
print(f"📦 Installing {package}...")
subprocess.check_call([sys.executable, "-m", "pip", "install", package])
print(f"✅ {package} installed successfully")
💡 Zero configuration required - just run and go!
🏆 Advantages over LaTeX
💡 This PDF Generator combines the simplicity of Markdown with the professionalism of LaTeX