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.

  • 1
    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
  • 1
    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
  • 1
    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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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