@@ -133,6 +133,7 @@ extension PSPDFDocument {
133133
134134 /// See `PSPDFDocumentSecurityOptions`
135135 public typealias SecurityOptions = PSPDFDocumentSecurityOptions
136+ public typealias SaveStrategy = PSPDFDocumentSaveStrategy
136137
137138 /// When saving a document, you can provide various save options.
138139 public enum SaveOption {
@@ -143,9 +144,11 @@ extension PSPDFDocument {
143144 /// space over time. Forcing a rewrite means the whole document file is rewritten
144145 /// from scratch leaving out all the outdated and unused parts.
145146 case security( SecurityOptions )
147+ /// Document saving strategy
148+ case strategy( SaveStrategy )
146149 /// A `SecurityOptions` instance, specifies the security options to
147150 /// use when saving the document.
148- case forceRewrite
151+ case forceSaving
149152 /// Applies all redactions in the document and removes the content underneath them.
150153 /// Not passing this option means redactions are not
151154 /// applied, and redaction annotations will stay in the document.
@@ -155,8 +158,10 @@ extension PSPDFDocument {
155158 switch self {
156159 case . security( let securityOptions) :
157160 return [ . securityOptions: securityOptions]
158- case . forceRewrite:
159- return [ . forceRewrite: NSNumber ( value: true ) ]
161+ case . forceSaving:
162+ return [ . forceSaving: NSNumber ( value: true ) ]
163+ case . strategy( let saveStrategy) :
164+ return [ . strategy: NSNumber ( value: saveStrategy. rawValue) ]
160165 case . applyRedactions:
161166 return [ . applyRedactions: NSNumber ( value: true ) ]
162167 }
@@ -261,8 +266,8 @@ internal class PDFDocumentTests {
261266 let document = PDFDocument ( )
262267 let securityOptions = try PDFDocument . SecurityOptions ( ownerPassword: " 0123456789012345678901234567890123456789 " , userPassword: " 0123456789012345678901234567890123456789 " , keyLength: 40 , permissions: [ . extract, . fillForms] , encryptionAlgorithm: . AES)
263268 document. add ( annotations: [ /* TODO: */ ] , options: [ . animateView( true ) , . suppressNotifications( false ) ] )
264- try document. save ( options: [ . security( securityOptions) , . forceRewrite ] )
265- document. save ( options: [ . security( securityOptions) , . forceRewrite ] ) { result in
269+ try document. save ( options: [ . security( securityOptions) , . forceSaving ] )
270+ document. save ( options: [ . security( securityOptions) , . forceSaving ] ) { result in
266271 _ = try ! result. dematerialize ( )
267272 }
268273 }
0 commit comments