///|
/// 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 : @geometry.PdfPosition,
scale : Double,
fast? : Bool = false,
) -> PdfDocument raise @core.PdfError {
pdf_page_box_validate_page_numbers(
page_numbers,
self.endpage(),
"scale_contents",
)
let pages = self.pages_of_pagetree()
let selected_pages = @core.pdf_number_set(page_numbers)
let rewritten : Array[@page.PdfPage] = Array(capacity=pages.length())
let matrices : Array[(Int, @geometry.TransformMatrix)] = Array(
capacity=page_numbers.length(),
)
for index in 0.. PdfDocument raise @core.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 : @geometry.PdfPosition,
scale : Double,
document : PdfDocument,
page_numbers : ArrayView[Int],
fast? : Bool = false,
) -> PdfDocument raise @core.PdfError {
document.scale_contents(page_numbers, position, scale, fast~)
}