Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encryption breaks GoTo Destinations #1513

Open
kmeis002 opened this issue Apr 16, 2024 · 0 comments
Open

Encryption breaks GoTo Destinations #1513

kmeis002 opened this issue Apr 16, 2024 · 0 comments

Comments

@kmeis002
Copy link

kmeis002 commented Apr 16, 2024

Bug Report

Description of the problem

Encrypting a PDF containing a GoTo action referencing a destination breaks the link. When converting the GoTo object in object.js, the string is encrypted. However, encryption does not occur in tree.js toString() method. The GoTo object no longer has a valid destination.

I'd be happy to take a stab at a PR if you'd like.

Code sample

const PDFDocument = require('pdfkit');
const fs = require('fs');
const doc = new PDFDocument({userPassword: '123'});

doc.pipe(fs.createWriteStream('./test3.pdf'));

doc.text("testing", { goTo: "heading2" });

doc.addPage();

doc.text("page2", {destination: "heading2"});

doc.end();

Your environment

  • pdfkit version: 0.15.0
  • Node version: v18.19.0
  • Browser version (if applicable):
  • Operating System: Debian (Bookworm)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant