feat: print files over 5,08 m are written at their real size
All checks were successful
Build and deploy / Validate source (push) Successful in 13s
Build and deploy / Integration suite on a real stack (push) Successful in 4m36s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Successful in 1m12s

PDF's /UserUnit scale kept long sheets within Acrobat's page limit, but
CorelDRAW, where Dropstar checks the files, ignores it and showed a 12,8 m
sheet at a third of its size. Long sheets now stay one page at real size;
PRINT_PAGE_SCALE=true in the stack goes back to the scale, for a RIP that
refuses pages over the limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-10-28 12:42:27 -03:00
parent ac22f9a2f6
commit 8257ac24ab
4 changed files with 34 additions and 10 deletions

View File

@@ -189,11 +189,19 @@ class PrintFileTests(unittest.TestCase):
with self.assertRaisesRegex(Unsupported, 'não é uma imagem'):
self.render(item([placement(0, 0, 20, 10)], [source(20, 10)], 10), [cdr])
def test_long_layouts_scale_user_space_instead_of_splitting(self):
# 6 m is longer than a PDF page may be (about 5.08 m).
def test_long_layouts_stay_one_page_at_real_size(self):
# 6 m is longer than Acrobat's page limit (5,08 m). Corel ignores
# /UserUnit, so the page is written at its real size (2026-10-28).
path = self.save(quadrants(40, 800), 'a.png')
pdf, detail = self.render(item([placement(0, 0, 30, 600)], [source(30, 600)], 600,
billed='6.0'), [path])
spec = item([placement(0, 0, 30, 600)], [source(30, 600)], 600, billed='6.0')
pdf, detail = self.render(spec, [path])
self.assertEqual(detail['user_unit'], 1)
self.assertNotIn(b'/UserUnit', pdf)
box = re.search(rb'/MediaBox \[ ?([\d. ]+)\]', pdf).group(1).split()
self.assertAlmostEqual(float(box[3]) / PT_PER_CM, 600, places=1)
# PRINT_PAGE_SCALE=true goes back to scaling user space instead.
with mock.patch.dict(os.environ, {'PRINT_PAGE_SCALE': 'true'}):
pdf, detail = self.render(spec, [path])
self.assertEqual(detail['user_unit'], 2)
self.assertIn(b'/UserUnit 2', pdf)