Skip to content

Commit

Permalink
Update for PSPDFKit 8.2 for iOS and 3.2 for macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
RadAzzouz committed Feb 8, 2019
1 parent 389ce8c commit 78c6487
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Example/PSPDFKitExample/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
platform :ios, '11.0'
use_frameworks!

pod 'PSPDFKitSwift', :git => 'https://github.com/PSPDFKit/PSPDFKit.swift.git', :tag => '1.1.1'
pod 'PSPDFKitSwift', :git => 'https://github.com/PSPDFKit/PSPDFKit.swift.git', :tag => '1.1.2'

target 'PSPDFKitExample' do

Expand Down
4 changes: 2 additions & 2 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ disclaimer as stated in the license.
You will require a commercial PSPDFKit License to run these examples
in non-demo mode. Please refer to [email protected] for details.

Copyright (c) 2010-2017, PSPDFKit GmbH.
Copyright (c) 2010-2019, PSPDFKit GmbH.
All rights reserved.

Redistribution and use in source or binary forms,
Expand Down Expand Up @@ -40,4 +40,4 @@ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Your `Podfile` should look like this:
```ruby
# Replace `YourAppName` with your app's target name.

pod 'PSPDFKitSwift', :git => 'https://github.com/PSPDFKit/PSPDFKitSwift.git', :tag => '1.1.1'
pod 'PSPDFKitSwift', :git => 'https://github.com/PSPDFKit/PSPDFKitSwift.git', :tag => '1.1.2'

target :YourAppName do
use_frameworks!
Expand Down
15 changes: 10 additions & 5 deletions Sources/PSPDFKitSwift/PSPDFDocument.swift
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ extension PSPDFDocument {

/// See `PSPDFDocumentSecurityOptions`
public typealias SecurityOptions = PSPDFDocumentSecurityOptions
public typealias SaveStrategy = PSPDFDocumentSaveStrategy

/// When saving a document, you can provide various save options.
public enum SaveOption {
Expand All @@ -143,9 +144,11 @@ extension PSPDFDocument {
/// space over time. Forcing a rewrite means the whole document file is rewritten
/// from scratch leaving out all the outdated and unused parts.
case security(SecurityOptions)
/// Document saving strategy
case strategy(SaveStrategy)
/// A `SecurityOptions` instance, specifies the security options to
/// use when saving the document.
case forceRewrite
case forceSaving
/// Applies all redactions in the document and removes the content underneath them.
/// Not passing this option means redactions are not
/// applied, and redaction annotations will stay in the document.
Expand All @@ -155,8 +158,10 @@ extension PSPDFDocument {
switch self {
case .security(let securityOptions):
return [.securityOptions: securityOptions]
case .forceRewrite:
return [.forceRewrite: NSNumber(value: true)]
case .forceSaving:
return [.forceSaving: NSNumber(value: true)]
case .strategy(let saveStrategy):
return [.strategy: NSNumber(value: saveStrategy.rawValue)]
case .applyRedactions:
return [.applyRedactions: NSNumber(value: true)]
}
Expand Down Expand Up @@ -261,8 +266,8 @@ internal class PDFDocumentTests {
let document = PDFDocument()
let securityOptions = try PDFDocument.SecurityOptions(ownerPassword: "0123456789012345678901234567890123456789", userPassword: "0123456789012345678901234567890123456789", keyLength: 40, permissions: [.extract, .fillForms], encryptionAlgorithm: .AES)
document.add(annotations: [ /* TODO: */ ], options: [.animateView(true), .suppressNotifications(false)])
try document.save(options: [.security(securityOptions), .forceRewrite])
document.save(options: [.security(securityOptions), .forceRewrite]) { result in
try document.save(options: [.security(securityOptions), .forceSaving])
document.save(options: [.security(securityOptions), .forceSaving]) { result in
_ = try! result.dematerialize()
}
}
Expand Down

0 comments on commit 78c6487

Please sign in to comment.