pdfkit-rs 0.2.0

Safe Rust bindings for Apple's PDFKit framework — documents, pages, selections, outlines, annotations, destinations, actions, and view state on macOS
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
mod common;

use pdfkit::prelude::*;

#[test]
fn border_style_roundtrip() -> Result<()> {
    let border = common::sample_border()?;
    let info = border.info()?;
    assert_eq!(info.style_enum(), Some(PdfBorderStyle::Dashed));
    assert!((info.line_width - 2.0).abs() < f64::EPSILON);
    let dash_pattern = info.dash_pattern.expect("dash pattern");
    assert_eq!(dash_pattern.len(), 2);
    assert!((dash_pattern[0] - 3.0).abs() < f64::EPSILON);
    assert!((dash_pattern[1] - 1.0).abs() < f64::EPSILON);
    Ok(())
}