# kcode-html-to-pdf
`kcode-html-to-pdf` renders one self-contained HTML document to PDF bytes through Ironpress.
## API
```rust
use kcode_html_to_pdf::{render, Font};
let pdf = render(
"<!doctype html><html><body><h1>Hello</h1></body></html>",
Vec::new(),
)?;
# Ok::<(), kcode_html_to_pdf::RenderError>(())
```
`render(html, fonts)` accepts HTML/CSS and zero or more custom TrueType fonts. Each `Font` supplies the CSS family name and raw TTF bytes. It returns PDF bytes or `RenderError`.
Keep the document self-contained. Put CSS in `<style>` elements or style attributes, use data URLs or inline SVG for images, and configure page size, margins, and page breaks with CSS such as `@page` and `break-before`.
HTML sanitization is enabled. Ironpress remote features are disabled, and this crate does not configure a filesystem base path. Rendering behavior follows the compatible Ironpress 1.x version selected by Cargo and is not promised to be pixel-stable across dependency upgrades.