sgr-ksmt / PDFGenerator

A simple generator of PDF written in Swift.
MIT License
757 stars 110 forks source link

PDF Protection #33

Closed ntthanh closed 8 years ago

ntthanh commented 8 years ago

Could you please add password protection for your lib?

sgr-ksmt commented 8 years ago

@ntthanh thanks for posting issue! I will implement this feature. please wait for a while 🙇

ntthanh commented 8 years ago

Thanks very much!

Have a good day and hope the feature will be in implemented soon :-)

Best, Thanh

-----Original Message----- From: "Suguru Kishimoto" notifications@github.com Sent: ‎7/‎8/‎2016 14:47 To: "sgr-ksmt/PDFGenerator" PDFGenerator@noreply.github.com Cc: "ntthanh" ntthanh@gmail.com; "Mention" mention@noreply.github.com Subject: Re: [sgr-ksmt/PDFGenerator] PDF Protection (#33)

@ntthanh thanks for posting issue! I will implement this feature. please wait for a while 🙇 — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

sgr-ksmt commented 8 years ago

@ntthanh I apologize for making you wait a long time... 🙇 I just have implemented password-protection in v1.3.0.

example is following:

Usage

do {
    // password protection (with string)
    try PDFGenerator.generate([v1, v2], outputPath: "path/to/file.pdf", password: "123abc")
    // or use PDFPassword model
    try PDFGenerator.generate([v1, v2], outputPath: "path/to/file.pdf", password: PDFPassword("123abc"))
    // or use PDFPassword model and set user/owner password.
    try PDFGenerator.generate([v1, v2], outputPath: "path/to/file.pdf", password: PDFPassword(user: "123abc", owner: "ABC123")
} catch PDFGenerateError.InvalidPassword(let password) {
    // ... if password can not convert ASCII.
} catch PDFGenerateError.TooLongPassword(let length) {
    // ... if password length is over 32.
}
ntthanh commented 8 years ago

Thank you very much. I will try this feature soon. Have a good day and thanks for your great works.

Best, Thanh On Jul 11, 2016 10:48 PM, "Suguru Kishimoto" notifications@github.com wrote:

@ntthanh https://github.com/ntthanh I apologize for making you wait a long time... 🙇 I just have implemented password-protection in v1.3.0 https://github.com/sgr-ksmt/PDFGenerator/releases/tag/1.3.0.

example is following: Usage

do { // password protection (with string) try PDFGenerator.generate([v1, v2], outputPath: "path/to/file.pdf", password: "123abc") // or use PDFPassword model try PDFGenerator.generate([v1, v2], outputPath: "path/to/file.pdf", password: PDFPassword("123abc")) // or use PDFPassword model and set user/owner password. try PDFGenerator.generate([v1, v2], outputPath: "path/to/file.pdf", password: PDFPassword(user: "123abc", owner: "ABC123") } catch PDFGenerateError.InvalidPassword(let password) { // ... if password can not convert ASCII. } catch PDFGenerateError.TooLongPassword(let length) { // ... if password length is over 32. }

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sgr-ksmt/PDFGenerator/issues/33#issuecomment-231776060, or mute the thread https://github.com/notifications/unsubscribe/ADBwo7_L_5YvmBgNwUaV-S8jI_U9UcL_ks5qUmXBgaJpZM4JHx5j .