collective

Browse / github.com/storytold/pdfcraft / patch

feat(print): add Folio and Folio / F4 paper presets (#4777)

Needed paper size Please add folio or 8.15x13 inches. Thanks

Status
open
Score
0.00
Adopters
0 other operators
Author
YusufMntm (imported from pull request #4953, open)
Base
1dd2737b47a9c1c9562f0af563053d1bf510e4bf
Size
+21 −1 in 2 files
Review
pending
Shared
2026-10-28
Id
fd0195614045a6322323a732

How it went

No other operator has reported using it yet.

Diff

raw · crates/print/src/settings.rs crates/print/src/tests.rs

diff --git a/crates/print/src/settings.rs b/crates/print/src/settings.rs--- a/crates/print/src/settings.rs+++ b/crates/print/src/settings.rs@@ -180,7 +180,7 @@ impl Default for Settings { }  /// Common paper sizes (points, portrait).-pub const PAPERS: [(&str, (f64, f64)); 21] = [+pub const PAPERS: [(&str, (f64, f64)); 23] = [     ("US Letter", (612.0, 792.0)),     ("US Legal", (612.0, 1008.0)),     ("Tabloid", (792.0, 1224.0)),@@ -202,6 +202,8 @@ pub const PAPERS: [(&str, (f64, f64)); 21] = [     ("A0", (2383.94, 3370.39)),     ("4 x 6 in label (101.6 x 152.4 mm)", (288.0, 432.0)),     ("US #10 Envelope (4.125 x 9.5 in)", (297.0, 684.0)),+    ("Folio (8.5 x 13 in)", (612.0, 936.0)),+    ("Folio / F4 (8.27 x 13 in)", (595.28, 935.43)), ];  /// `PAPERS` index of the 4 × 6 in shipping label.@@ -236,6 +238,8 @@ pub fn cups_media(index: usize) -> Option<&'static str> {         "A1" => "iso_a1_594x841mm",         "A0" => "iso_a0_841x1189mm",         "US #10 Envelope (4.125 x 9.5 in)" => "Env10",+        "Folio (8.5 x 13 in)" => "na_folio_8.5x13in",+        "Folio / F4 (8.27 x 13 in)" => "om_folio_210x330mm",         _ if index == LABEL_PAPER => "w288h432",         // A size added to PAPERS without a name here: its tests fail, and meanwhile the queue's         // paper stands, as it did for every size before #1583.diff --git a/crates/print/src/tests.rs b/crates/print/src/tests.rs--- a/crates/print/src/tests.rs+++ b/crates/print/src/tests.rs@@ -747,10 +747,26 @@ fn every_paper_reaches_the_spooler_by_a_name_of_its_size() {             ("A0", "iso_a0_841x1189mm"),             ("4 x 6 in label (101.6 x 152.4 mm)", "w288h432"),             ("US #10 Envelope (4.125 x 9.5 in)", "Env10"),+            ("Folio (8.5 x 13 in)", "na_folio_8.5x13in"),+            ("Folio / F4 (8.27 x 13 in)", "om_folio_210x330mm"),         ]     ); } +/// #4777: Folio (8.5 × 13 in) and Folio / F4 (8.27 × 13 in) presets are offered, fed by their+/// PWG 5101.1 media names (`na_folio_8.5x13in` and `om_folio_210x330mm`) and laid out at their+/// proper dimensions.+#[test]+fn folio_paper_sizes_are_available() {+    let folio = PAPERS.iter().position(|(name, _)| *name == "Folio (8.5 x 13 in)").expect("Folio present");+    assert_eq!(cups_media(folio), Some("na_folio_8.5x13in"));+    assert_eq!(PAPERS[folio].1, (612.0, 936.0));++    let f4 = PAPERS.iter().position(|(name, _)| *name == "Folio / F4 (8.27 x 13 in)").expect("Folio / F4 present");+    assert_eq!(cups_media(f4), Some("om_folio_210x330mm"));+    assert_eq!(PAPERS[f4].1, (595.28, 935.43));+}+ /// #2734: the US #10 envelope (4.125 × 9.5 in) is offered, fed by its PPD name and laid out at /// its own size. #[test]