MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / _pdf_to_iframe_html

Function _pdf_to_iframe_html

demo/app.py:630–640  ·  view source on GitHub ↗
(pdf_path: Path, width="100%", height="900px")

Source from the content-addressed store, hash-verified

628 return None
629
630def _pdf_to_iframe_html(pdf_path: Path, width="100%", height="900px") -> str:
631 try:
632 b = pdf_path.read_bytes()
633 b64 = base64.b64encode(b).decode("utf-8")
634 return (
635 f"<div style='border:1px solid #ddd;border-radius:8px;overflow:hidden'>"
636 f"<embed type='application/pdf' width='{width}' height='{height}' src='data:application/pdf;base64,{b64}'></embed>"
637 f"</div>"
638 )
639 except Exception:
640 return ""
641
642def _pdf_to_iframe_file(pdf_path: Path, width="100%", height="900px") -> str:
643 try:

Callers 3

debug_compile_output_zipFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected