diff options
author | Hans Hagen <pragma@wxs.nl> | 2018-09-21 20:54:51 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2018-09-21 20:54:51 +0200 |
commit | 7c2efd42267783f01b64e0a47cba89f84742618c (patch) | |
tree | 4517e6bd3e024424dd82c5bb3c5e800cdff06fea /tex/context/base/mkiv/grph-inc.lua | |
parent | 56ca0139232f16679918613ef45a5dd643f0f9b3 (diff) | |
download | context-7c2efd42267783f01b64e0a47cba89f84742618c.tar.gz |
2018-09-21 20:00:00
Diffstat (limited to 'tex/context/base/mkiv/grph-inc.lua')
-rw-r--r-- | tex/context/base/mkiv/grph-inc.lua | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/tex/context/base/mkiv/grph-inc.lua b/tex/context/base/mkiv/grph-inc.lua index e9d3170af..ff37e7b6d 100644 --- a/tex/context/base/mkiv/grph-inc.lua +++ b/tex/context/base/mkiv/grph-inc.lua @@ -2090,22 +2090,35 @@ local function pdf_checker(data) -- pdfdoc.nofcopiedpages = 0 -- - local info = querypdf(pdfdoc,request.page) - local bbox = info and info.boundingbox or { 0, 0, 0, 0 } + local info = querypdf(pdfdoc,request.page) + local bbox = info and info.boundingbox or { 0, 0, 0, 0 } + local height = bbox[4] - bbox[2] + local width = bbox[3] - bbox[1] + local rotation = info.rotation or 0 + if rotation == 90 then + rotation, height, width = 3, width, height + elseif rotation == 180 then + rotation = 2 + elseif rotation == 270 then + rotation, height, width = 1, width, height + elseif rotation == 1 or rotation == 3 then + height, width = width, height + else + rotation = 0 + end return { filename = filename, -- page = 1, pages = pdfdoc.nofpages, - width = bbox[3] - bbox[1], - height = bbox[4] - bbox[2], + width = width, + height = height, depth = 0, colordepth = 0, xres = 0, yres = 0, - xsize = 0, - ysize = 0, - rotation = 0, - orientation = 0, + xsize = width, + ysize = height, + rotation = rotation, } end end |