///|
/// Scale selected page contents and annotations around a cpdf-style position.
///
/// The transform origin is calculated from `/CropBox` when present, otherwise
/// `/MediaBox`. Destination references for scaled pages are transformed with
/// the same matrix.
pub fn PdfDocument::scale_contents(
self : PdfDocument,
page_numbers : ArrayView[Int],
position : PdfPosition,
scale : Double,
fast? : Bool = false,
) -> PdfDocument raise PdfError {
pdf_page_box_validate_page_numbers(
page_numbers,
self.endpage(),
"scale_contents",
)
let pages = self.pages_of_pagetree()
let selected_pages = @number_set.pdf_number_set(page_numbers)
let rewritten : Array[PdfPage] = Array::new(capacity=pages.length())
let matrices : Array[(Int, TransformMatrix)] = Array::new(
capacity=page_numbers.length(),
)
for index in 0.. PdfDocument raise PdfError {
document.scale_contents(page_numbers, position, scale, fast~)
}
///|
/// Compatibility wrapper matching cpdfpage's `scale_contents` argument order.
pub fn pdf_scale_contents_cpdf_order(
position : PdfPosition,
scale : Double,
document : PdfDocument,
page_numbers : ArrayView[Int],
fast? : Bool = false,
) -> PdfDocument raise PdfError {
document.scale_contents(page_numbers, position, scale, fast~)
}