mod haru_bindings;
pub mod document;
pub mod font;
pub mod haru_types;
pub mod image;
pub mod page;
pub mod prelude {
pub use crate::document::*;
pub use crate::font::*;
pub use crate::haru_types::*;
pub use crate::image::*;
pub use crate::page::*;
}
pub type ErrorCallback =
extern "C" fn(error_no: i32, detail_no: i32, user_data: *mut std::ffi::c_void);
pub struct HpdfBox {
pub left: f32,
pub bottom: f32,
pub right: f32,
pub top: f32,
}
impl From<haru_bindings::HPDF_Box> for HpdfBox {
fn from(hpdf_box: haru_bindings::HPDF_Box) -> Self {
HpdfBox {
left: hpdf_box.left,
bottom: hpdf_box.bottom,
right: hpdf_box.right,
top: hpdf_box.top,
}
}
}
pub fn libharu_version() -> String {
let version = unsafe { haru_bindings::HPDF_GetVersion() };
let version = unsafe { std::ffi::CStr::from_ptr(version) };
version.to_str().unwrap().to_string()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_libharu_version() {
let version = libharu_version();
println!("libharu version: {}", version);
}
}