Hello, two questions about pages in PDF document (slightly refers to the code http://www.mail-archive.com/ntg-context@ntg.nl/msg57502.html):
---- local MyDocument = lpdf.epdf.load("A4.pdf") context.starttext() local pages = MyDocument.pages local dummy = MyDocument.pages[1] -- we need lua 5.2 in order to avoid this local nofpages = #MyDocument.pages context.starttabulate { "|c|c|c|" } context.NC() context("page") context.NC() context("width") context.NC() context("height") context.NR() for i=1, nofpages do local page = pages[i] local bbox = page.CropBox or page.MediaBox context.NC() context(i) context.NC() context(bbox[4]-bbox[2]) context.NC() context(bbox[3]-bbox[1]) context.NR() end context.stoptabulate() context.stoptext() ---- The sample gives: w ~ 842 pt, h ~ 595 pt Questions: 1. Shouldn't be width and height swapped? As the analyzed 'A4.pdf' has width of 210 mm and height of 297 mm, IOW width < height, whilst the cld code gives w > h (?!). 2. Is it possible to get rotation or orientation of the page (be "portrait" or "landscape" or "0" or "90" or so)? 3. Is the 'bbox' already affected by the page rotation/orientation? I mean - in the case page orientation is 90 or 270, is the width and height of 'bbox' swapped compared to the situation if page orientation was 0 (or 180)? Best regards, Lukas -- Ing. Lukáš Procházka | mailto:l...@pontex.cz Pontex s. r. o. | mailto:pon...@pontex.cz | http://www.pontex.cz | IDDS:nrpt3sn Bezová 1658 147 14 Praha 4 Tel: +420 241 096 751 (+420 720 951 172) Fax: +420 244 461 038
A4.pdf
Description: Adobe PDF document
PdfInfo.cld
Description: Binary data
PdfInfo.pdf
Description: Adobe PDF document
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________