Skip to content

[Tearsheet] PNG export — 1200x900 image for README embed and social sharing #35

Description

@DogInfantry

Part of epic: #30
Depends on: #33 (HTML render must exist first)

What

Add render_png() method to TearsheetGenerator that takes a headless screenshot of the HTML tearsheet and saves it as a 1200x900px PNG. This image is embedded directly in the README as the primary demo artifact — a recruiter sees the output quality before running a single line of code.

Implementation options (choose one)

Option A — playwright (preferred)

def render_png(self, output_path: str) -> None:
    from playwright.sync_api import sync_playwright
    html = self.render_html()
    with sync_playwright() as p:
        browser = p.chromium.launch()
        page = browser.new_page(viewport={'width': 1200, 'height': 900})
        page.set_content(html)
        page.screenshot(path=output_path, full_page=False)
        browser.close()

Option B — selenium (fallback if playwright not available)

Acceptance Criteria

  • render_png(path) saves a 1200x900px PNG without manual browser interaction
  • PNG is committed to /outputs/demo/tearsheet_AAPL.png
  • README ![Tearsheet Demo](outputs/demo/tearsheet_AAPL.png) embed works on GitHub
  • playwright or selenium added to requirements-dev.txt (not main, since it's optional)
  • Graceful fallback if headless browser not available (warn, skip, don't crash pipeline)

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions