TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I asked a similar question on tracking codes. which was migrated to SO.

This is a bit different.

Can a PDFLateX output have a counter?

Can a link on a PDFLaTeX output have a counter associated with it so that when the link is followed the counter goes up by 1.

share|improve this question
You can include a hyperlink in a PDF document. How you count whether someone accessed the resource located behind the link is a different problem, though (and not related to TeX). – Jake Jun 25 '13 at 20:06
Your best bet is to put a counter on the number of times the PDF is served by your server; without that kind of access though, it'll be difficult. From that point you can probably embed some JS to grab content---I've seen PDF do this kind of thing before (though I have no idea how to bring it about with pdfLaTeX). – Sean Allred Jun 25 '13 at 22:07
These questions are not really about the capabilities of Pdftex and are all about what the Adobe standard lets PDFs do. Yes, Pdftex lets you insert arbitrary objects into the PDFs it generates, so it doesn't stand in your way if Adobe doesn't, but it has nothing to do with your PDF once it is generated. – Charles Stewart Jun 26 '13 at 12:42
up vote 5 down vote accepted

It seems to be possible via Acrobat JavaScript API, either you have Adobe Acrobat or try the appropriate package for LaTeX:

My suggestion is to increase the counter on every user´s mouse click (which still does not guarantee that the user actually visits the page, because the Adobe Reader has a permission request per default).

Some hints:

  1. How to store variable data in PDF after close?

  2. Processing Acrobat Forms using JavaScript, Internal Processing of a Field, Part 1: The Event Object and the Action Tab

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.