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: Sun, 31 Jul 2022 23:58:07 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.11.0

<snip>

thanks for the explanations re PDFPIC and status of 1.22.4.

regarding the current issue I unintentionally replied only to deri directly in 
last mail.
here is the essential part again:

I had located that sed "creature" and it indeed does not work for me. I suspect this has to do with those captures and sed incompatibilities regarding how to quote the \(...\). but I did not persist and instead inserted (@DERI: there was a typo in the `print' statements in my mail to you: the semicolons where mispositioned...):

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

at that place which seems cleaner and easier to poor me... and that indeed does then do the job and it works just fine afterwards.

what do you think: should that better be done with awk similar to the above? which such an easy script one definitely will not run into nawk vs. mawk vs. gawk incomptibilities (I believe OSX uses freeBSD awk which is a decendant of nawk and linux sure uses gawk -- and mawk is the nicest and fastest of them all ;)).

br/joerg

On 31.07.22 23:42, G. Branden Robinson wrote:
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



reply via email to

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