It turns out I was thinking too much within pdf.js
I had been tinkering with it for hours, and even this question itself has changed a dozen times because I kept finding new leads.
However, I've now found a simple solution.
- Instead of accessing my servlet as
/getPdf?nodeRef=001
, I access it/getPdf/001
- My servlet mapping is now
/getPdf/*
The servlet contains the following new code in doGet:
String nodeRef = request.getPathInfo().substring(1);
This omits the need for basic GET
parameters in the url, at least in the format ?a=1&b=2
, and works fine to pass a variable to a servlet that returns a PDF file using pdf.js
.
EDIT: I have editted my question title to reflect the situation so that those who stumble upon this problem too may find their answer here.