carbon-a-release / export_still.py
lvwerra's picture
lvwerra HF Staff
Present the tree with a wide title and resource links; remove sweep counters and playback button
e5675eb verified
Raw History Blame Contribute Delete
702 Bytes
"""Export the current presentation at 2× resolution, without capture controls."""
from pathlib import Path
import sys
sys.path.insert(0,'/home/node/local/carbon-a-render/python')
from playwright.sync_api import sync_playwright
from check_presentation import BROWSER,ARGS
R=Path(__file__).parent
with sync_playwright() as p:
b=p.chromium.launch(executable_path=BROWSER,args=ARGS)
page=b.new_page(viewport={'width':1080,'height':1350},device_scale_factor=2)
page.goto((R/'index.html').as_uri()+'?record=1')
page.wait_for_function('window.POC && !document.querySelector("#loading")',timeout=60000)
page.screenshot(path=str(R/'carbon-a-strand-poc.png'))
b.close()
print(R/'carbon-a-strand-poc.png')