[dev-context] external pdf references

Taco Hoekwater taco at elvenkind.com
Tue Dec 11 10:21:14 CET 2012


Hi Hans,

You know we at Docwolves do lots of stuff with

   \externalfigure[extern.pdf][interaction=yes]

right? That sometimes produces errors. Some of those are hard to send
back to you because the PDFs tend to be confidential, but there are two
cases where valid but unexpected external references wreak havoc that
are easy to explain and report:

The first is:

    mailto:"someone at gmail.com"

(with embedded " symbols). Resulting in

      ) expected near 'someone'

error from lua, and it required us to patch context like so:

\def\doifreferencefoundelse#1#2#3% 

   {\ctxcommand {doifelsereference("\referenceprefix ",[[#1]], % "#1"
                    \luaconditional \highlighthyperlinks ,
                    \luaconditional \gotonewwindow )}
                    {\expandtexincurrentreference #2}{#3}}


The second was a variation of:

   C:\TEMP\FILE.PDF

(I forgot the real example). This of course results in

	Undefined control sequence: \\TEMP

from luatex, and it required an extra line in link_uri in
lpdf-epa.lua:

local function link_uri(x,y,w,h,document,annotation)
     local url = annotation.A.URI
     url = string.gsub(url,"\\","/") -- TH Don't want backslashes here
     if url then
         add_link(x,y,w,h,format("url(%s)",url),"url")
     end
end


For the other bugs (which are ones where I often doubt whether the
external pdf was even correct in the first place) I am attaching my
versions of lpdf-epa.lua and lpdf-epd.lua for you to compare with your
version. Unfortunately, we are using "2012.06.20 20:43", so that may
be too old to help much. But you can grep for TH in the source and
perhaps get some inspiration ;)

Best wishes,
Taco




-------------- next part --------------
A non-text attachment was scrubbed...
Name: lpdf-epa.lua
Type: text/x-lua
Size: 8181 bytes
Desc: not available
URL: <http://www.ntg.nl/pipermail/dev-context/attachments/20121211/f5c3a147/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lpdf-epd.lua
Type: text/x-lua
Size: 9888 bytes
Desc: not available
URL: <http://www.ntg.nl/pipermail/dev-context/attachments/20121211/f5c3a147/attachment-0003.bin>


More information about the dev-context mailing list