bug-groff
[Top][All Lists]
Advanced

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

Re: PDFPIC misbehaves if called two times in a row


From: joerg van den hoff
Subject: Re: PDFPIC misbehaves if called two times in a row
Date: Mon, 1 Aug 2022 16:22:42 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.11.0

ok, I did what you've proposed. *none* of the commands in that pipe fails. even 
the complete pipe
including `sed` yields exist status 0 but outputs

Page size:       510 x 318 pts

i.e. the unmodified output from the initial grep. this is on OSX rather than 
linux.

as already stated in previous mail to deri: it seems that "my" sed does want 
single backslashes
for defining the parenthesis around the backreference patterns (if there is not 
a further level
of protection necessary when using the script in the `.sy' call in pdfpic.tmac).
on the shell prompt, I get the correct result here, when using

pdfinfo yourfile.pdf | tr -d '\000' | grep "Page *size" \
  | sed -e 's/Page *size: *\([[:digit:].]*\) *x *\([[:digit:].]*\).*$/\
.nr pdfpic*width (p;\\1)\\n\
.nr pdfpic*height  (p;\\2)/' || echo failed, status $?

(note `\(...\)' instead of `\\(...\\)').

no idea, why exactly it does not work for me but seemingly does work for 
everybody else out of the box?

as said, for the time being I have settled at replacing that grep|sed thingy by 
a simple(r) awk call:

awk '/Page[ ]+size:/ {\
   print ".nr pdfpic*width (p;" $3 ")";\
   print ".nr pdfpic*height (p;" $5 ")";\
}' > @*[pdfpic*temporary-file]

so problem solved temporarily (until next update run of the package manager ;)).

best,
joerg

...

I would try running the command that the `PDFPIC` macro is running.
Build up the pipeline step by step and check the exit status at every
point.  (I have the exit status of the previous command in my shell
prompt for this reason.)

pdfinfo yourfile.pdf || echo failed, status $?
pdfinfo yourfile.pdf | tr -d '\000' || echo failed, status $?
pdfinfo yourfile.pdf | tr -d '\000' | grep "Page *size" \
   || echo failed, status $?
pdfinfo yourfile.pdf | tr -d '\000' | grep "Page *size" \
   | sed -e 's/Page *size: *\\([[:digit:].]*\\) *x *\\([[:digit:].]*\\).*$/\
.nr pdfpic*width (p;\\1)\\n\
.nr pdfpic*height  (p;\\2)/' || echo failed, status $?

so no inclusion of pictures at all...?

Since the `PDFPIC` macro is failing to perform an essential
operation--it has to know how big the image is--that's right.

However it should be possible to sort this out with the procedure above.
It is a combination of Bernd Warken's code and mine; a true
Frankenstein's monster, in other words.  But without a PDF interpreter
built in to the GNU troff formatter or requiring the user to do
preparatory work to create PDF or image file descriptions out-of-band, I
can't imagine any other way this work could get done.

Some details may need to be fiddled, of course.

Regards,
Branden

[1] ...or string, or diversion...



reply via email to

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