diff --git a/mkdocs_exporter/formats/pdf/browser.py b/mkdocs_exporter/formats/pdf/browser.py index 1e469d6..96b9c93 100644 --- a/mkdocs_exporter/formats/pdf/browser.py +++ b/mkdocs_exporter/formats/pdf/browser.py @@ -102,10 +102,10 @@ async def print(self, html: str) -> tuple[bytes, int]: pages = int(await context.locator('body').get_attribute('mkdocs-exporter-pages') or 0) pdf = await context.pdf(prefer_css_page_size=True, print_background=True, display_header_footer=False) - os.unlink(file) - await context.close() + os.unlink(file.name) + return (pdf, pages)