TransWikia.com

Redefining href for accessibility

TeX - LaTeX Asked on January 14, 2021

I’m using tagpdf.sty to make accessible pdf from LaTeX. So far I can do everything except add the UA metadata. But there is a minor issue with (re)definig href. Here is a simplified version of what I am using. I need the URI, an anchor text and a comment in the pdf, which can be produced by pdftag in LaTeX or LuaLaTeX.

The problem is that #2 might be split over a line. So, in principle, we might need two or more pdfannots. Can anyone suggest a method to handle this?

newlength{@Href@Width}
newlength{@Href@Height}
newlength{@Href@Depth}
newcommandHref[3]{%  URI/text/comment
  tagstructbegin{tag=Link}
  push@mc{16}% Link
  tagmcbegin{tag=Link}
  settowidth{@Href@Width}{#2}
  settoheight{@Href@Height}{vphantom{(}#2}
  settodepth{@Href@Depth}{vphantom{(}#2}
  addtolength{@Href@Width}{1pt}
  addtolength{@Href@Height}{1pt}
  addtolength{@Href@Depth}{1pt}
  pdfannot width @Href@Width height @Href@Height depth
  @Href@Depth {/Subtype/Link/Contents(#3)/Border[ 0 0 0.5 [1 1] ]
    /C[ 0 0.5 1 ] /A << /S/URI/Type/Action/URI(#1) >> }#2
  ifthenelse{boolean{mc@fza}}{emc}{}
  pop@mc%
  tagstructend% Link
}

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP