flowchart LR
Units[PdfUnit] --> Paper[PaperSize]
Paper --> PageBox[page MediaBox]
Point[Point2] --> Matrix[TransformMatrix]
Ops[TransformOp list] --> Matrix
Matrix --> PointOut[transformed point]///|
test "paper sizes and units are explicit" {
if @geometry.paper_a4.unit() != Millimetre {
fail("A4 is stored in millimetres")
}
if @geometry.unit_points(1.0, Inch) != 72.0 {
fail("one inch is 72 PDF points")
}
let landscape = @geometry.paper_a4.landscape()
if landscape.width() != 297.0 || landscape.height() != 210.0 {
fail("landscape swaps paper width and height")
}
}///|
test "transforms apply to points and render as PDF matrices" {
let moved = @geometry.transform_translate(5.0, -10.0).apply(
@geometry.point2(10.0, 20.0),
)
if moved.x != 15.0 || moved.y != 10.0 {
fail("translation should move the point")
}
inspect(
@geometry.transform_string_of_matrix(
@geometry.transform_translate(5.0, -10.0),
),
content="1, 0, 0, 1, 5, -10",
)
}#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn PdfCalculatedPosition::equal(PdfCalculatedPosition, PdfCalculatedPosition) -> Bool#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn PdfCalculatedPosition::not_equal(x : PdfCalculatedPosition, y : PdfCalculatedPosition) -> Bool#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn PdfCalculatedPosition::to_json(PdfCalculatedPosition) -> Json#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn PdfCalculatedPosition::to_repr(PdfCalculatedPosition) -> Repr#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn PdfCoordRectangle::equal(PdfCoordRectangle, PdfCoordRectangle) -> Bool#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn PdfCoordRectangle::not_equal(x : PdfCoordRectangle, y : PdfCoordRectangle) -> Bool#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn PdfCoordRectangle::to_json(PdfCoordRectangle) -> Json#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn PdfCoordRectangle::to_repr(PdfCoordRectangle) -> Reprpub(all) enum PdfPosition {
PdfPositionPosCentre(Double, Double)
PdfPositionPosLeft(Double, Double)
PdfPositionPosRight(Double, Double)
PdfPositionTop(Double)
PdfPositionTopLeft(Double, Double)
PdfPositionTopRight(Double, Double)
PdfPositionLeft(Double)
PdfPositionBottomLeft(Double, Double)
PdfPositionBottom(Double)
PdfPositionBottomRight(Double, Double)
PdfPositionRight(Double)
PdfPositionDiagonal
PdfPositionReverseDiagonal
PdfPositionCentre
} derive(Eq, ToJson, Debug)#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn PdfPosition::equal(PdfPosition, PdfPosition) -> Bool#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn PdfPosition::not_equal(x : PdfPosition, y : PdfPosition) -> Bool#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn PdfPosition::to_json(PdfPosition) -> Json#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn PdfPosition::to_repr(PdfPosition) -> Repr#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn PdfRectangle::equal(PdfRectangle, PdfRectangle) -> Bool#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn PdfRectangle::not_equal(x : PdfRectangle, y : PdfRectangle) -> Bool#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn PdfRectangle::to_json(PdfRectangle) -> Json#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn PdfRectangle::to_repr(PdfRectangle) -> Repr#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn TransformDecomposition::equal(TransformDecomposition, TransformDecomposition) -> Bool#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn TransformDecomposition::not_equal(x : TransformDecomposition, y : TransformDecomposition) -> Bool#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn TransformDecomposition::to_json(TransformDecomposition) -> Json#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn TransformDecomposition::to_repr(TransformDecomposition) -> Repr#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn TransformMatrix::equal(TransformMatrix, TransformMatrix) -> Bool#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn TransformMatrix::not_equal(x : TransformMatrix, y : TransformMatrix) -> Bool#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn TransformMatrix::to_json(TransformMatrix) -> Json#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn TransformMatrix::to_repr(TransformMatrix) -> Repr#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn TransformOp::equal(TransformOp, TransformOp) -> Bool#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn TransformOp::not_equal(x : TransformOp, y : TransformOp) -> Bool#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn TransformOp::to_json(TransformOp) -> Json#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn TransformOp::to_repr(TransformOp) -> Reprfn pdf_calculate_position(ignore_distance : Bool, text_width : Double, bounds : PdfRectangle, position : PdfPosition) -> PdfCalculatedPositionfn transform_append(after : ArrayView[TransformOp], before : ArrayView[TransformOp]) -> Array[TransformOp]fn transform_recompose_components(scale : Double, aspect : Double, rotation : Double, shear : Double, translate_x : Double, translate_y : Double) -> TransformMatrixInstall
Download zipByte-oriented PDF reading, writing, and manipulation toolkit for MoonBit.
Dependencies