Skip Navigation

Preparing a PDF for a lawyer and other orgs to use in court. PDF bookmarks, evidence labels, etc. Using LaTeX.

I’ve been using LaTeX to prepare legal documents in PDF format with a tree of PDF bookmarks like this:

  • list of facts
    -- exhibit A
    -- exhibit B
    -- exhibit C
    -- exhibit D
  • law
    -- national
    -- international

So if you click “exhibit C” in the sidebar of the PDF viewer, it jumps to that document which has “exhibit C” in the corner of the doc in a bubble, along with commentary like “redactions in Bob’s version but not Alice’s”. I have no idea to what extent courts and lawyers appreciate or oppose metadata like this.

Some recipients want to see a verbatim version of the document without my markups. I am tempted to use the \usepackage{attachfile} … \attachfile{exhibit_c.pdf} which puts a thumbtack on the page whereby someone can click it and extract the original version without markups. The problem is that this embeds another redundant copy of the document in the PDF so every document presented will have two copies and ultimately double the size of the PDF.

Is there a tool or method that would enable just one copy of every doc to be stored in the PDF and the commentary to be in an overlay layer that can be toggled for printing and also toggled for on-screen viewing?

PDF annotations kind of try to have that effect, but the PDF standard for annotations is a disaster. Most apps force their own way of rendering a PDF annotation, which is often implemented as a tiny yellow Post-It note and it ignores the author’s font. PDF annotations lack control and look like garbage in most PDF viewers and likely even worse when printed.

(update) This thread mentions several ways to write annotations on top of a document in LaTeX:

https://overflow.manganiello.tech/exchange/tex/questions/15314/how-can-i-superimpose-latex-tex-output-over-a-pdf-file

I’ve always used the overpic method. But the problem is no one talks about how to make the overlay content a separate layer that viewers can give different treatment to. When a viewer opens a PDF where overpic was used to apply markups to an original PDF, it’s all the same single layer to the viewer. E.g. I tell Okular not to print annotations, and yet it prints my overpic markups anyway.

The top response to this thread mentions the pdfcomment package. I’ve used it. It gives no way to put an object of your creation in the annotation layer. You can use a \pdffreetextcomment command but then you have extremely limited rudimentary control over the appearance.

ATM it’s not even clear if the PDF spec can accommodate an annotation layer that is not confined to a fixed set of spec-defined objects.

solution

The LaTeX package ocgx2 seems to solve the problem. It supports custom user-defined PDF layers than can be toggled in many viewers. This code adds an evidence label that can be toggled on and off:

 undefined
    
\usepackage{ocgx2}
\usepackage{pdfpages}
\usepackage{hyperref}
…  
\pdfbookmark{Exibit A}{A}
\includepdf[pages=1-,picturecommand={%
  \put(500,800){\begin{ocg}{Evidence labels}{el}{on}
      \Large\rotatebox{-45}{\fbox{Exhibit~A}}
    \end{ocg}}
}]{evidence.pdf}

  
0 comments

No comments

Start the conversation!