Honour declared paper size in route-D output

This commit is contained in:
gloamxun committed 2026-10-23 03:53:32 +08:00
1 parent 043ae7f072
commit 7b9d543e49
7 files changed
+142 -33

No files matched your search

+23 -7
View File
@@ -345,13 +345,29 @@ pub fn display_lists_to_pdf_with_origin(
page_height: i64,
origin: PageOrigin,
) -> Vec<u8> {
let height = page_height.max(792 * 65_536);
let width = pages
.iter()
.map(|page| page.width)
.max()
.unwrap_or(612 * 65_536)
.max(612 * 65_536);
display_lists_to_pdf_with_paper(
pages,
pages
.iter()
.map(|page| page.width)
.max()
.unwrap_or(612 * 65_536)
.max(612 * 65_536),
page_height.max(792 * 65_536),
origin,
)
}
/// Write several display lists as a multi-page PDF with an explicit paper
/// size (TeX `\paperwidth`/`\paperheight`) and page origin offsets.
pub fn display_lists_to_pdf_with_paper(
pages: &[DisplayList],
page_width: i64,
page_height: i64,
origin: PageOrigin,
) -> Vec<u8> {
let width = page_width;
let height = page_height;
let mut objects: Vec<Vec<u8>> = Vec::new();
objects.push(b"<< /Type /Catalog /Pages 2 0 R >>".to_vec());