Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
Fix #2610: Replace markdown-pdf with reportlab to resolve AGPL license conflict
Louis26628d96c603
diff --git a/browser_use/filesystem/file_system.py b/browser_use/filesystem/file_system.pyindex 5fc194783..3a62e13cb 100644--- a/browser_use/filesystem/file_system.py+++ b/browser_use/filesystem/file_system.py@@ -6,8 +6,10 @@ from concurrent.futures import ThreadPoolExecutorfrom pathlib import Pathfrom typing import Any-from markdown_pdf import MarkdownPdf, Sectionfrom pydantic import BaseModel, Field+from reportlab.lib.pagesizes import letter+from reportlab.lib.styles import getSampleStyleSheet+from reportlab.platypus import Paragraph, SimpleDocTemplate, SpacerINVALID_FILENAME_ERROR_MESSAGE = 'Error: Invalid filename format. Must be alphanumeric with supported extension.'DEFAULT_FILE_SYSTEM_PATH = 'browseruse_agent_data'@@ -120,9 +122,32 @@ class PdfFile(BaseFile):def sync_to_disk_sync(self, path: Path) -> None:file_path = path / self.full_nametry:- md_pdf = MarkdownPdf()- md_pdf.add_section(Section(self.content))- md_pdf.save(file_path)+ # Create PDF document+ doc = SimpleDocTemplate(str(file_path), pagesize=letter)+ styles = getSampleStyleSheet()+ story = []++ # Convert markdown content to simple text and add to PDF+ # For basic implementation, we'll treat content as plain text+ # This avoids the AGPL license issue while maintaining functionality+ content_lines = self.content.split('\n')++ for line in content_lines:+ if line.strip():+ # Handle basic markdown headers+ if line.startswith('# '):+ para = Paragraph(line[2:], styles['Title'])+ elif line.startswith('## '):+ para = Paragraph(line[3:], styles['Heading1'])+ elif line.startswith('### '):+ para = Paragraph(line[4:], styles['Heading2'])+ else:+ para = Paragraph(line, styles['Normal'])+ story.append(para)+ else:+ story.append(Spacer(1, 6))++ doc.build(story)except Exception as e:raise FileSystemError(f"Error: Could not write to file '{self.full_name}'. {str(e)}")diff --git a/pyproject.toml b/pyproject.tomlindex 455d9273d..4fd65aad2 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -41,7 +41,7 @@ dependencies = ["google-auth-oauthlib>=1.2.2","mcp>=1.10.1","pypdf>=5.7.0",- "markdown-pdf==1.5",+ "reportlab>=4.0.0",]# google-api-core: only used for Google LLM APIs# pyperclip: only used for examples that use copy/paste