Enabling encryption prevents destination links from working.
chuckntaylor opened this issue · 1 comments
chuckntaylor commented
Bug Report
Description of the problem
It seems that when a userPassword is set in the config, that destination links stop working.
Code sample
Setting up a new document
const doc = new PDFDocument({
size: 'LETTER',
layout: 'landscape',
margin: 0,
autoFirstPage: false,
bufferPages: true,
info: { Title: bookTitle, Author: '' },
userPassword: 'somePassword'
})
// Then on one of the pages:
doc.addNamedDestination('LINK');
// Later linking to the other page
doc.text('A goto', 20, 0, {
goTo: 'LINK',
});
The links work when there is not userPassword set, but fail to work when set.
Your environment
- pdfkit version: 0.15.0
- Node version: 22.2.0
- Browser version (if applicable):
- Operating System: Mac OS 14.5
chuckntaylor commented
In the docs I see that pdfVersion
defaults to 1.3
. Changing this to a later version (I've only tested 1.7ext3
and 1.7
) seems to resolve the issue. My suspicion is that the encoding/decoding in 1.3 does something to the destination names. Anyway, gonna mark this as closed.