use carbonpdf::{PageSize, PdfBuilder, Result};
#[tokio::main]
async fn main() -> Result<()> {
let html = r#"
<!DOCTYPE html>
<html>
<head>
<style>
body {
font-family: Arial, sans-serif;
margin: 40px;
}
h1 { color: #333; }
.content {
background: #f0f0f0;
padding: 20px;
border-radius: 8px;
}
</style>
</head>
<body>
<h1>Welcome to CarbonPDF</h1>
<div class="content">
<p>This is a sample PDF generated from HTML.</p>
<ul>
<li>High-quality rendering</li>
<li>CSS support</li>
<li>Production-ready</li>
</ul>
</div>
</body>
</html>
"#;
let pdf = PdfBuilder::new()
.html(html)
.page_size(PageSize::A4)
.margin_all(1.0)
.print_background(true)
.build()
.await?;
std::fs::write("basic_output.pdf", pdf)?;
println!("PDF generated: basic_output.pdf");
Ok(())
}