diff options
author | Hans Hagen <pragma@wxs.nl> | 2023-03-07 00:19:30 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2023-03-07 00:19:30 +0100 |
commit | c677baac37632308600b5108b586f80246056c74 (patch) | |
tree | 308800d3f841d4c65121729535a093b7f9646eb4 /tex/context/base/mkxl/lpdf-lmt.lmt | |
parent | e12b4fabeb0ce3ce6d256b54250cf38a8f940561 (diff) | |
download | context-c677baac37632308600b5108b586f80246056c74.tar.gz |
2023-03-06 23:17:00
Diffstat (limited to 'tex/context/base/mkxl/lpdf-lmt.lmt')
-rw-r--r-- | tex/context/base/mkxl/lpdf-lmt.lmt | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/tex/context/base/mkxl/lpdf-lmt.lmt b/tex/context/base/mkxl/lpdf-lmt.lmt index 1d47c1620..f443632b8 100644 --- a/tex/context/base/mkxl/lpdf-lmt.lmt +++ b/tex/context/base/mkxl/lpdf-lmt.lmt @@ -2130,6 +2130,20 @@ local finalize do local f_group = formatters["Gp%d"] local f_image = formatters["Im%d"] + local function checkedbox(mediabox,otherbox,what) + if otherbox and #mediabox == 4 and #otherbox == 4 then + local done = false + if otherbox[1] < mediabox[1] then done = true ; otherbox[1] = mediabox[1] end + if otherbox[2] < mediabox[2] then done = true ; otherbox[2] = mediabox[2] end + if otherbox[3] > mediabox[3] then done = true ; otherbox[3] = mediabox[3] end + if otherbox[4] > mediabox[4] then done = true ; otherbox[4] = mediabox[4] end + if done then + report("limiting %a to 'MediaBox'",what) + end + end + return otherbox + end + finalize = function(driver,details) if not details then @@ -2226,9 +2240,9 @@ else -- Indirect objects don't work in all viewers. - if TrimBox then pageattributes.TrimBox = pdfsharedobject(TrimBox ) end - if CropBox then pageattributes.CropBox = pdfsharedobject(CropBox ) end - if BleedBox then pageattributes.BleedBox = pdfsharedobject(BleedBox) end + if TrimBox then pageattributes.TrimBox = pdfsharedobject(checkedbox(bbox,TrimBox,"TrimBox")) end + if CropBox then pageattributes.CropBox = pdfsharedobject(checkedbox(bbox,CropBox,"CropBox")) end + if BleedBox then pageattributes.BleedBox = pdfsharedobject(checkedbox(bbox,BleedBox,"BleedBox")) end end |