pub fn parse_into_bytes_with_images(
markdown: String,
markdown_path: &Path,
config: ConfigSource<'_>,
font_config: Option<&FontConfig>,
) -> Result<Vec<u8>, MdpError>Expand description
Transforms Markdown content with image support into a byte vector PDF.
Similar to parse_into_bytes but with support for resolving relative image paths.
This is useful when you need PDF bytes but still want images to be loaded relative
to the markdown document location.
§Arguments
markdown- The Markdown content to convertmarkdown_path- Path to the markdown document (for resolving relative image references)config- Configuration source (Default, File path, or Embedded TOML)font_config- Optional font configuration
§Returns
Ok(Vec<u8>)containing the PDF data on successful conversionErr(MdpError)if errors occur
§Example
use markdown2pdf::config::ConfigSource;
use std::path::Path;
let markdown = "# Title\n".to_string();
let pdf = markdown2pdf::parse_into_bytes_with_images(
markdown,
Path::new("document.md"),
ConfigSource::Default,
None
);