From: context@vivaldi.net
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: checking whether file is landscape or portrait
Date: Thu, 30 Jan 2020 13:08:39 +0100 [thread overview]
Message-ID: <515ee81100778b4163eeb8a7914ce21d@vivaldi.net> (raw)
In-Reply-To: <8d065ab7-4e5e-b935-c793-a6fda58a1521@gmx.es>
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
name = { name = name, page = page }
end
if name.name then
local data = figures.push(name)
local info = figures.identify()
if info.status.status ~= 0 then
figures.check() -- !Counts pages here!
end
figures.pop()
return --data
info
end
end
----
'info' might return not only width and height of the image, but also its
orientation/rotation.
And it would be up to you whether to swap width/height depending on
orientation.
Hope this helps.
Best regards,
Lukas
On 2020-01-29 16:44, Pablo Rodriguez wrote:
> 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, chapter 20:
>>
>> * \ifdim<dimen1><relation><dimen2> (compares two dimensions)
>> This is like \ifnum, but it compares two <dimen> values. For
>> example, to test whether the value of \hsize exceeds 100pt, you
>> can say ‘\ifdim\hsize>100pt’.
>>
>> The definition of \ifnum, right above it, states:
>>
>> * \ifnum<number1><relation><number2> (compares two integers)
>> The <relation> must be either ‘<’ or ‘=’ or ‘>’. The two
>> integer numbers are compared to each other in the usual way, and
>> the result is true or false accordingly.
>
> Many thanks for your reply, Arthur.
>
> The explanation is extremely clear. I think I should try to read the
> TeXbook (but I need time for this first).
>
> Many thanks for your help,
>
> Pablo
___________________________________________________________________________________
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
___________________________________________________________________________________
prev parent reply other threads:[~2020-01-30 12:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-28 15:51 Pablo Rodriguez
2020-01-28 16:04 ` Taco Hoekwater
2020-01-28 16:39 ` Pablo Rodriguez
2020-01-28 16:46 ` Wolfgang Schuster
2020-01-28 16:15 ` Wolfgang Schuster
2020-01-28 16:43 ` Pablo Rodriguez
2020-01-29 13:31 ` Arthur Reutenauer
2020-01-29 15:44 ` Pablo Rodriguez
2020-01-30 12:08 ` context [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=515ee81100778b4163eeb8a7914ce21d@vivaldi.net \
--to=context@vivaldi.net \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).