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

Can I password protect a pdf generated using react-pdf? #672

Open
lutherdexter opened this issue Jul 29, 2019 · 5 comments
Open

Can I password protect a pdf generated using react-pdf? #672

lutherdexter opened this issue Jul 29, 2019 · 5 comments

Comments

@lutherdexter
Copy link

lutherdexter commented Jul 29, 2019

I have a requirement to allow users to scrape contents of a page by exporting to pdf. A must have feature is to give users the ability to password-protect the pdf at run-time.

Is this feature available in react-pdf or do you know of third-party tools that I can use alongside your component?

@diegomura
Copy link
Owner

It's not, and not sure if pdfkit supports it

@mpopv
Copy link

mpopv commented Sep 17, 2019

It does support it. https://github.com/foliojs/pdfkit/blob/master/docs/getting_started.md#encryption-and-access-privileges

However I'm not sure if react-pdf is the right place to implement it, as the browser would prompt the user for a password on every rerender.

@chetanbura
Copy link

+1 for the password-protected PDF feature.
This is a very useful feature.

Any plans to consider this feature?

@bernardobgam
Copy link

@diegomura
pdfkit supports it, you just need to expose an options object to the construction of the PDFDocument. https://pdfkit.org/docs/guide.pdf (page 8)

You have the option to add a userPassword and an ownerPassword.

While are here you can also expose the permission option object.

const new PDFDocument({ 
    ...,
    userPassword: 'password1',
    ownerPassword: 'password1',
    permission: {
        printing: false,
        modifying: false,
        copying: false,
        annotating: false,
        fillingForms: false,
        contentAccessibility: false,
       documentAssembly: false,
} })

@max-degterev
Copy link

Did you guys figure out a way to pass those options down to the pdfkit? The way I see it there is no way at the moment right?

Would be nice to allow for extra options/props to be just passed through to the pdfkit.

klimeryk added a commit to klimeryk/react-pdf that referenced this issue Mar 29, 2024
klimeryk added a commit to klimeryk/react-pdf that referenced this issue Mar 29, 2024
klimeryk added a commit to klimeryk/react-pdf that referenced this issue Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants