groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] PDFPIC macro


From: Keith Marshall
Subject: Re: [Groff] PDFPIC macro
Date: Thu, 18 Sep 2014 00:22:01 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.0

On 17/09/14 22:22, Peter Schaffter wrote:
> On Wed, Sep 17, 2014, Steffen Nurpmeso wrote:
>> I'm not in the position to say something to PDFPIC today (direct
>> support would be pretty cool!), but there should be general tools
>> for sh(1) (perl(1)...) that can be included in a defined way and
>> used.  I.e., roff "libraries".
>>
>> And the very same is true for generic use of external commands, as
>> is used by you, and what came to my mind immediately when reading:
>>
>>   .  sy pdfinfo @$1 | \
>>   grep "Page *size" | \
>>   sed -e 's/Page *size: *\\([[:digit:].]*\\) *x *\\([[:digit:].]*\\).*$/\
>>   .nr pdf-wid (p;\\1)\\n\
>>   .nr pdf-ht  (p;\\2)/' \
>>   > /tmp/pdfpic\n[$$]
>>
>> For example here.  There should be a way to safely generate
>> temporary file names in the temporary directory that is currently
>> used, whatever this is (most likely $TMPDIR).
> 
> Yes.  The way groff stands now, I'm uneasy relying on external tools
> and .sy for anything but local, user-written macros.  There's precedent,
> though, in www.tmac (PIMG), and this seems to be the best solution
> for PDF images.

Do note, however, that this will compromise portability; e.g. pdfinfo is
unlikely to be supported on MS-Windows hosts.  Also, since .sy is an
intrinsically unsafe request, any macro which relies on it *must* be
invoked in unsafe mode, and users should rightly be wary of enabling
that, for untrusted sources.

-- 
Regards,
Keith.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]