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

Crash when passing nil as a password on PDFDocument creation #32

Closed
CKzu opened this issue Jan 3, 2017 · 2 comments
Closed

Crash when passing nil as a password on PDFDocument creation #32

CKzu opened this issue Jan 3, 2017 · 2 comments

Comments

@CKzu
Copy link

CKzu commented Jan 3, 2017

Hi and first of all thanks for the work!

I encountered an issue while using the library : when I tried to create a PDFDocument instance for a file without a password, my first attempt was to call PDFDocument(filePath: path, password: nil), which caused my app to crash with mysterious error messages.

I managed to fixed it by calling PDFDocument(filePath: path, password: "").

This should be either stated clearly in the docs (maybe I've missed it?) or fixed in the code.

Cheers!

@pushchris
Copy link
Contributor

@CKzu that is very strange, the default implementation of PDFDocument without a password (PDFDocument(filePath: path)) simply calls PDFDocument(filePath: path, password: nil). So nil should not be giving you any issues (in theory). Can you paste the crash log?

Additionally, you can take a look here at how opening a PDF is handled. The only time it will send you a CGPDFDocumentError is if the file is encrypted and no password is provided.

@pushchris
Copy link
Contributor

I modified the document unlocking logic a littler bit in the latest build. Give it a try, if you are still having issues, feel free to re-open.

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

2 participants