pub mod pdf_writer_backend;
use crate::{fonts::ShapedGlyph, styles::RgbColor};
pub trait PdfBackend {
fn draw_text(
&mut self,
text: &str,
x_mm: f64,
y_mm: f64,
font_size_pt: f64,
font_ref: FontRef,
color: &RgbColor,
letter_spacing_pt: f32,
) -> crate::Result<()>;
fn draw_shaped_glyphs(
&mut self,
glyphs: &[ShapedGlyph],
x_mm: f64,
y_mm: f64,
font_size_pt: f64,
font_ref: FontRef,
color: &RgbColor,
) -> crate::Result<()>;
fn draw_line(
&mut self,
x1_mm: f64,
y1_mm: f64,
x2_mm: f64,
y2_mm: f64,
width_pt: f32,
color: &RgbColor,
) -> crate::Result<()>;
fn draw_rect(
&mut self,
x_mm: f64,
y_mm: f64,
width_mm: f64,
height_mm: f64,
fill: &RgbColor,
) -> crate::Result<()>;
fn draw_rect_stroked(
&mut self,
x_mm: f64,
y_mm: f64,
width_mm: f64,
height_mm: f64,
fill: &RgbColor,
stroke: &RgbColor,
stroke_pt: f32,
) -> crate::Result<()>;
fn draw_text_rotated(
&mut self,
text: &str,
cx_mm: f64,
cy_mm: f64,
font_size_pt: f64,
font_ref: FontRef,
color: &RgbColor,
angle_deg: f64,
half_width_mm: f64,
) -> crate::Result<()>;
fn new_page(&mut self, width_mm: f64, height_mm: f64) -> crate::Result<()>;
fn finish(&mut self) -> crate::Result<Vec<u8>>;
fn save_state(&mut self);
fn restore_state(&mut self);
fn set_opacity(&mut self, opacity: f64) -> crate::Result<()>;
fn reset_opacity(&mut self);
fn begin_tagged_content(&mut self, _tag_name: &[u8], _mcid: u32) {}
fn end_tagged_content(&mut self) {}
fn begin_artifact_content(&mut self) {}
fn current_page_idx(&self) -> usize { 0 }
fn write_structure_tree(
&mut self,
_events: &[crate::compliance::ua::StructEvent],
_lang: &str,
) {}
fn add_outline_entry(&mut self, _title: &str, _level: u8, _page_idx: usize, _y_mm: f64) {}
fn add_link_annotation(
&mut self,
_x1_mm: f64,
_y1_mm: f64,
_x2_mm: f64,
_y2_mm: f64,
_dest_title: &str,
_dest_page_estimate: u32,
) {}
fn embed_image(&mut self, data: &[u8]) -> crate::Result<ImageRef>;
fn draw_image(
&mut self,
img_ref: ImageRef,
x_mm: f64,
y_mm: f64,
width_mm: f64,
height_mm: f64,
);
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct FontRef(pub u32);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct ImageRef(pub u32);