PDF.js Express Version – 7.3.3
Detailed description of issue
Trying to add custom headers on document load to send some extra information, and the headers aren’t being set on the request
I’ve tried multiple iterations of this as well, with the same results.
Expected behaviour
The headers are set on every request
Does your issue happen with every document, or just one?
Every document
Code snippet
useEffect(() => {
if (!viewerInstance) return;
const customHeaders = Object();
customHeaders["X-HL-Current-Organization"] = getCurrentOrgId();
customHeaders.test = "header";
const { docViewer } = viewerInstance;
docViewer.loadDocument(`/v1/chart/${chartId}/pdf`, {
extension: "pdf",
customHeaders,
httpHeaders: customHeaders,
});
}, [viewerInstance]);
I’ve also tried this with the same result:
useEffect(() => {
if (!viewerInstance) return;
viewerInstance.loadDocument(`/v1/chart/${chartId}/pdf`, {
extension: "pdf",
customHeaders: { "X-HL-Current-Organization": getCurrentOrgId() },
});
}, [viewerInstance]);