4

Using pdfliteral, one can color text like the following:

      w1_prev = node.new("whatsit","pdf_literal")
      w1_prev.data = "q 1 0 0 rg"
      w1_prev.mode = 1

      w2_prev = node.new("whatsit","pdf_literal")
      w2_prev.data = "Q"
      w2_prev.mode = 1

      node.insert_after(prev_line.prev,prev_line.prev,w1_prev) --color text between prev_line.prev...
      node.insert_before(prev_line,prev_head,w2_prev) -- and prev_head

Is there a code similar to q 1 0 0 rg which highlights text instead of coloring the letters?

raphink
  • 31,894

1 Answers1

1

This question is more appropriate on a PDF q&a site :)

You can draw PDF boxes with the code I posted in my answer to the one letter word problem. Just be sure to put the pdf_literal at the beginning of the text, so the text is on top of that box.

topskip
  • 37,020
  • Right, I know about the boxes (from reading and using your code), but what I would like to achieve is to highlight the text :-) – raphink Sep 19 '11 at 09:49
  • 1
    At least at the TeX level, 'highlighting' is always done by boxing material up, as you can only set the background of a box, not of particular text. – Joseph Wright Sep 19 '11 at 10:31