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

2020-01-30 Thread context
Hello Pablo, also Lua might be useful for you - some code like the one bellow, which is based on an answer in this forum years ago: assert(not figures.getinfo2) figures.getinfo2 = function(name, page) -- [ [NTG-context] Pdf info with Lua/Ctx API ] if type(name) == "string" then n

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

2020-01-29 Thread Pablo Rodriguez
On 1/29/20 2:31 PM, Arthur Reutenauer wrote: > On Tue, Jan 28, 2020 at 05:43:36PM +0100, Pablo Rodriguez wrote: >> I’m afraid this is the second time I’m aware of the existence of \ifdim >> (the first time was when reading previous message from Taco 😅). > > It’s a TeX primitive. From the TeXbook

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

2020-01-29 Thread Arthur Reutenauer
On Tue, Jan 28, 2020 at 05:43:36PM +0100, Pablo Rodriguez wrote: > I’m afraid this is the second time I’m aware of the existence of \ifdim > (the first time was when reading previous message from Taco 😅). It’s a TeX primitive. From the TeXbook, chapter 20: * \ifdim (compares two dimen

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

2020-01-28 Thread Wolfgang Schuster
On Tue, 28 Jan 2020 17:04:52 +0100 Taco Hoekwater wrote: > Hi Pablo, > > I have had lots of problems with getting the correct figure dimensions > for external images. In the end, I now use the code below. It is just > as low-level and much more inefficient than your code, but it has not > faile

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

2020-01-28 Thread Pablo Rodriguez
On 1/28/20 5:15 PM, Wolfgang Schuster wrote: > On Tue, 28 Jan 2020 16:51:35 +0100 Pablo Rodriguez wrote: >> [...] >> At least, I would like to know how to get image dimension numbers >> suitable to be deployed with \ifnum. > > Use \ifdim to compare dimensions. Many thanks for your reply, Wolfgang.

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

2020-01-28 Thread Pablo Rodriguez
Many thanks for your reply, Taco. It helps me a lot to manipulate the images (which are actually PDF documents). I have another question about an issue that I experience at work. Some of the PDF documents I have to deal with are poorly generated. There are misplaced A4 pages inside legal paper si

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

2020-01-28 Thread Wolfgang Schuster
On Tue, 28 Jan 2020 16:51:35 +0100 Pablo Rodriguez 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: > > \unprotec

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

2020-01-28 Thread Taco Hoekwater
Hi Pablo, I have had lots of problems with getting the correct figure dimensions for external images. In the end, I now use the code below. It is just as low-level and much more inefficient than your code, but it has not failed me yet. \newdimen\MYfigurewidth \newdimen\MYfigureheight \unex

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

2020-01-28 Thread Pablo Rodriguez
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