On Tue, 28 Jan 2020 16:51:35 +0100 Pablo Rodriguez <oi...@gmx.es> wrote:
> Dear list, > > I have to check whether an external PDF document is portrait or > landscape (in order to manipulate it in different ways). > > From what I understand of grph-inc.mkiv, I came with the following sample: > > \unprotect > \def\figureXSize{\clf_figurestatus{width}{}} > \def\figureYSize{\clf_figurestatus{height}{}} > \protect > > \setupexternalfigures[location=default] > \starttext > \getfiguredimensions[cow.pdf] > \figuresize\\ > \figurelabel\\ > \figureXSize\\ > \figureYSize\\ > \ifnum\figureXSize<\figureYSize portrait\else landscape\fi > \stoptext > > I feel bad of abusing the ConTeXt source in such a miserable way. But > I’m afraid this is the best I can. > > Is there no standard way to check portrait or landscape on a given > figure? A conditional for that would be useful. > > At least, I would like to know how to get image dimension numbers > suitable to be deployed with \ifnum. Use \ifdim to compare dimensions. \setupexternalfigures[location=default] \starttext \getfiguredimensions[mill.png] \ifdim\figurewidth>\figureheight landscape% \else portrait% \fi \getfiguredimensions[cow.pdf] \ifdim\figurewidth>\figureheight landscape% \else portrait% \fi \stoptext Wolfgang ___________________________________________________________________________________ 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 ___________________________________________________________________________________