[NTG-context] checking whether file is landscape or portrait

Pablo Rodriguez oinos at gmx.es
Tue Jan 28 16:51:35 CET 2020


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.

Many thanks for your help,

Pablo
--
http://www.ousia.tk


More information about the ntg-context mailing list