bpampuch / pdfmake

Client/server side PDF printing in pure JavaScript
http://pdfmake.org
Other
11.52k stars 2.03k forks source link

Printing option disabled in generated pdf If access privileges added #1626

Closed kumarandena closed 5 years ago

kumarandena commented 5 years ago

Issue - Cannot print the generated PDF If access privileges added while PDF generation.

Expected - Want to disable copying contents from pdf by adding access privileges copying permission with printing option enabled on resulted pdf file.

Tried Sample:

var dd = {
ownerPassword: '123456',
    permissions: {
    printing: 'highResolution',
    modifying: false,
    copying: false,
    annotating: true,
    fillingForms: true, 
    contentAccessibility: true,
    documentAssembly: true
  },
    content: [
        'Hello world!',
        'Another paragraph, this time a little bit longer to make sure, this line will be divided into at least two lines',
        {
            image: 'sampleImage.jpg',
            fit: [100, 100]
        },
    ]

}
liborm85 commented 5 years ago

Bug is in pdfkit, created PR for fix: https://github.com/foliojs/pdfkit/pull/917

kumarandena commented 5 years ago

@liborm85 security-printing-fix PR got merged into pdfkit.

I checked an expected scenario in pdfmake playground but no luck. I am not yet tried in local machine.

liborm85 commented 5 years ago

New pdfkit version must be released.

kumarandena commented 5 years ago

I just forgot it, I will stay tuned for the next version release!

kumarandena commented 5 years ago

@liborm85 I tried to apply this bugfix locally for now till pdfkit next version release.

Project Environment:

  1. AngularJS app
  2. Installed pdfmake into project and copied pdfmake & pdfkit folders from node modules and pasted inside app/plugins folder then referred pdfmake scripts inside index.html
  3. Removed pdfmake dependencies from global node_modules and package.json since its referred from folder inside app directory.
  4. pdfmake works fine as expected

What tried so far to adopt this bugfix change locally:

  1. Checkedout pdfkit github repo, And packed it using,
    • npm install
    • npm run build
    • npm pack
  2. .tgz tarball file got generated then copied generated files from .tgz and pasted needed files inside app/plugins/pdfkit
  3. pdfkit files contains this bugfix change(right number mask to allow print) and Rebuilt the project but its not worked, No luck.

I am not having clear idea in editing pdfmake library locally and use it in project, Can you please guide me on this?

kumarandena commented 5 years ago

@liborm85 New pdfkit version was released : https://github.com/foliojs/pdfkit/pull/941#issuecomment-487798836 But Still I don't get expected scenario in pdfmake playground.

liborm85 commented 5 years ago

New version released.

kumarandena commented 5 years ago

Great, Thanks @liborm85.