Skip to content

Commit 1c13ffb

Browse files
Merge pull request #23 from kaferi/master
Update to v20.2
2 parents df3cac0 + 2ecae9d commit 1c13ffb

File tree

7 files changed

+232
-8
lines changed

7 files changed

+232
-8
lines changed

AsposePdfCloud.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Pod::Spec.new do |s|
55
s.ios.deployment_target = '10.0'
66
s.osx.deployment_target = '10.11'
77
s.tvos.deployment_target = '9.0'
8-
s.version = '20.1.0'
8+
s.version = '20.2.0'
99
s.swift_version = '4.1'
1010
s.source = { :git => 'https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-swift.git', :tag => s.version.to_s }
1111
s.authors = 'Aspose PDF Cloud'

AsposePdfCloud.xcodeproj/project.pbxproj

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
128B4CEC238C25F500877D55 /* ComboBoxFieldResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 128B4CE8238C25F500877D55 /* ComboBoxFieldResponse.swift */; };
3939
128B4CED238C25F500877D55 /* ComboBoxField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 128B4CE9238C25F500877D55 /* ComboBoxField.swift */; };
4040
128B4CEE238C25F500877D55 /* ComboBoxFields.swift in Sources */ = {isa = PBXBuildFile; fileRef = 128B4CEA238C25F500877D55 /* ComboBoxFields.swift */; };
41+
12AE101C23F45BD7007D00A5 /* 4pagesPdfA.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 12AE101B23F45BD6007D00A5 /* 4pagesPdfA.pdf */; };
4142
1E52FD8B2189F2AB00DEDC40 /* LineAnnotation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E52FD702189F2A700DEDC40 /* LineAnnotation.swift */; };
4243
1E52FD8C2189F2AB00DEDC40 /* PolygonAnnotation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E52FD712189F2A700DEDC40 /* PolygonAnnotation.swift */; };
4344
1E52FD8D2189F2AB00DEDC40 /* CircleAnnotationsResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E52FD722189F2A700DEDC40 /* CircleAnnotationsResponse.swift */; };
@@ -439,6 +440,7 @@
439440
128B4CE8238C25F500877D55 /* ComboBoxFieldResponse.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ComboBoxFieldResponse.swift; sourceTree = "<group>"; };
440441
128B4CE9238C25F500877D55 /* ComboBoxField.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ComboBoxField.swift; sourceTree = "<group>"; };
441442
128B4CEA238C25F500877D55 /* ComboBoxFields.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ComboBoxFields.swift; sourceTree = "<group>"; };
443+
12AE101B23F45BD6007D00A5 /* 4pagesPdfA.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = 4pagesPdfA.pdf; sourceTree = "<group>"; };
442444
1E52FD702189F2A700DEDC40 /* LineAnnotation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LineAnnotation.swift; sourceTree = "<group>"; };
443445
1E52FD712189F2A700DEDC40 /* PolygonAnnotation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PolygonAnnotation.swift; sourceTree = "<group>"; };
444446
1E52FD722189F2A700DEDC40 /* CircleAnnotationsResponse.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CircleAnnotationsResponse.swift; sourceTree = "<group>"; };
@@ -1139,6 +1141,7 @@
11391141
1E668BBC2174B2E2004218A8 /* TestData */ = {
11401142
isa = PBXGroup;
11411143
children = (
1144+
12AE101B23F45BD6007D00A5 /* 4pagesPdfA.pdf */,
11421145
1E84B8C3233CF4F000057874 /* FormDataTextBox.pdf */,
11431146
1ED9932F231FC39700725F99 /* 33226.p12 */,
11441147
1ED99326231EB51600725F99 /* FormData.fdf */,
@@ -1394,6 +1397,7 @@
13941397
isa = PBXResourcesBuildPhase;
13951398
buildActionMask = 2147483647;
13961399
files = (
1400+
12AE101C23F45BD7007D00A5 /* 4pagesPdfA.pdf in Resources */,
13971401
1E84B8C4233CF4F100057874 /* FormDataTextBox.pdf in Resources */,
13981402
1ED99331231FC3B500725F99 /* 33226.p12 in Resources */,
13991403
1ED99329231EB51600725F99 /* FormDataXfa_in.xml in Resources */,
@@ -2001,7 +2005,7 @@
20012005
"@executable_path/Frameworks",
20022006
"@loader_path/Frameworks",
20032007
);
2004-
MARKETING_VERSION = 20.1.0;
2008+
MARKETING_VERSION = 20.2.0;
20052009
PRODUCT_BUNDLE_IDENTIFIER = com.aspose.AsposePdfCloud;
20062010
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
20072011
SKIP_INSTALL = YES;
@@ -2030,7 +2034,7 @@
20302034
"@executable_path/Frameworks",
20312035
"@loader_path/Frameworks",
20322036
);
2033-
MARKETING_VERSION = 20.1.0;
2037+
MARKETING_VERSION = 20.2.0;
20342038
PRODUCT_BUNDLE_IDENTIFIER = com.aspose.AsposePdfCloud;
20352039
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
20362040
SKIP_INSTALL = YES;

AsposePdfCloud/APIs/PdfAPI.swift

Lines changed: 119 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8039,6 +8039,60 @@ open class PdfAPI {
80398039
return requestBuilder.init(method: "GET", URLString: (urlObj?.string ?? URLString), parameters: parameters, isBody: false)
80408040
}
80418041

8042+
/**
8043+
Convert PDFA file (located on storage) to PDF format and return resulting file in response.
8044+
8045+
- parameter srcPath: (query) Full source filename (ex. /folder1/folder2/template.pdf)
8046+
- parameter dontOptimize: (query) If set, document resources will not be optimized. (optional)
8047+
- parameter storage: (query) The document storage. (optional)
8048+
- parameter completion: completion handler to receive the data and the error objects
8049+
*/
8050+
open class func getPdfAInStorageToPdf(srcPath: String, dontOptimize: Bool? = nil, storage: String? = nil, completion: @escaping ((_ data: Data?,_ error: Error?) -> Void)) {
8051+
AuthAspose.checkAuth() {
8052+
(authError) in
8053+
guard authError == nil else {
8054+
completion(nil, authError)
8055+
return
8056+
}
8057+
getPdfAInStorageToPdfWithRequestBuilder(srcPath: srcPath, dontOptimize: dontOptimize, storage: storage).execute { (response, error) -> Void in
8058+
completion(response?.body, error);
8059+
}
8060+
}
8061+
}
8062+
8063+
8064+
/**
8065+
Convert PDFA file (located on storage) to PDF format and return resulting file in response.
8066+
- GET /pdf/create/pdfa
8067+
- OAuth:
8068+
- type: oauth2
8069+
- name: JWT
8070+
- examples: [{output=none}]
8071+
8072+
- parameter srcPath: (query) Full source filename (ex. /folder1/folder2/template.pdf)
8073+
- parameter dontOptimize: (query) If set, document resources will not be optimized. (optional)
8074+
- parameter storage: (query) The document storage. (optional)
8075+
8076+
- returns: RequestBuilder<Data>
8077+
*/
8078+
open class func getPdfAInStorageToPdfWithRequestBuilder(srcPath: String, dontOptimize: Bool? = nil, storage: String? = nil) -> RequestBuilder<Data> {
8079+
let pathUrl = "/pdf/create/pdfa"
8080+
let URLString = AsposePdfCloudAPI.basePath + pathUrl
8081+
let parameters: [String:Any]? = nil
8082+
8083+
let urlObj = NSURLComponents(string: URLString)
8084+
urlObj?.queryItems = APIHelper.mapValuesToQueryItems(values:[
8085+
"srcPath": srcPath,
8086+
"dontOptimize": dontOptimize,
8087+
"storage": storage
8088+
])
8089+
8090+
8091+
let requestBuilder: RequestBuilder<Data>.Type = AsposePdfCloudAPI.requestBuilderFactory.getBuilder()
8092+
8093+
return requestBuilder.init(method: "GET", URLString: (urlObj?.string ?? URLString), parameters: parameters, isBody: false)
8094+
}
8095+
80428096
/**
80438097
Converts PDF document (located on storage) to DOC format and returns resulting file in response content
80448098

@@ -10855,7 +10909,7 @@ open class PdfAPI {
1085510909
Add document bookmarks.
1085610910

1085710911
- parameter name: (path) The document name.
10858-
- parameter bookmarkPath: (path) The bookmark path.
10912+
- parameter bookmarkPath: (path) The parent bookmark path. Specify an empty string when adding a bookmark to the root.
1085910913
- parameter bookmarks: (body) The array of bookmark.
1086010914
- parameter folder: (query) The document folder. (optional)
1086110915
- parameter storage: (query) The document storage. (optional)
@@ -10884,7 +10938,7 @@ open class PdfAPI {
1088410938
- examples: [{contentType=application/json, example=""}]
1088510939

1088610940
- parameter name: (path) The document name.
10887-
- parameter bookmarkPath: (path) The bookmark path.
10941+
- parameter bookmarkPath: (path) The parent bookmark path. Specify an empty string when adding a bookmark to the root.
1088810942
- parameter bookmarks: (body) The array of bookmark.
1088910943
- parameter folder: (query) The document folder. (optional)
1089010944
- parameter storage: (query) The document storage. (optional)
@@ -17557,6 +17611,69 @@ open class PdfAPI {
1755717611
return requestBuilder.init(method: "PUT", URLString: (urlObj?.string ?? URLString), parameters: parameters, isBody: false)
1755817612
}
1755917613

17614+
/**
17615+
Convert PDFA file (located on storage) to PDF format and upload resulting file to storage.
17616+
17617+
- parameter name: (path) The document name.
17618+
- parameter srcPath: (query) Full source filename (ex. /folder1/folder2/template.pdf)
17619+
- parameter dstFolder: (query) The destination document folder. (optional)
17620+
- parameter dontOptimize: (query) If set, document resources will not be optimized. (optional)
17621+
- parameter storage: (query) The document storage. (optional)
17622+
- parameter completion: completion handler to receive the data and the error objects
17623+
*/
17624+
open class func putPdfAInStorageToPdf(name: String, srcPath: String, dstFolder: String? = nil, dontOptimize: Bool? = nil, storage: String? = nil, completion: @escaping ((_ data: AsposeResponse?,_ error: Error?) -> Void)) {
17625+
AuthAspose.checkAuth() {
17626+
(authError) in
17627+
guard authError == nil else {
17628+
completion(nil, authError)
17629+
return
17630+
}
17631+
putPdfAInStorageToPdfWithRequestBuilder(name: name, srcPath: srcPath, dstFolder: dstFolder, dontOptimize: dontOptimize, storage: storage).execute { (response, error) -> Void in
17632+
completion(response?.body, error);
17633+
}
17634+
}
17635+
}
17636+
17637+
17638+
/**
17639+
Convert PDFA file (located on storage) to PDF format and upload resulting file to storage.
17640+
- PUT /pdf/{name}/create/pdfa
17641+
- OAuth:
17642+
- type: oauth2
17643+
- name: JWT
17644+
- examples: [{contentType=application/json, example={
17645+
"Status" : "Status",
17646+
"Code" : 0
17647+
}}]
17648+
17649+
- parameter name: (path) The document name.
17650+
- parameter srcPath: (query) Full source filename (ex. /folder1/folder2/template.pdf)
17651+
- parameter dstFolder: (query) The destination document folder. (optional)
17652+
- parameter dontOptimize: (query) If set, document resources will not be optimized. (optional)
17653+
- parameter storage: (query) The document storage. (optional)
17654+
17655+
- returns: RequestBuilder<AsposeResponse>
17656+
*/
17657+
open class func putPdfAInStorageToPdfWithRequestBuilder(name: String, srcPath: String, dstFolder: String? = nil, dontOptimize: Bool? = nil, storage: String? = nil) -> RequestBuilder<AsposeResponse> {
17658+
var pathUrl = "/pdf/{name}/create/pdfa"
17659+
pathUrl = pathUrl.replacingOccurrences(of: "{name}", with: "\(name)", options: .literal, range: nil)
17660+
let URLString = AsposePdfCloudAPI.basePath + pathUrl
17661+
let parameters: [String:Any]? = nil
17662+
17663+
let urlObj = NSURLComponents(string: URLString)
17664+
urlObj?.queryItems = APIHelper.mapValuesToQueryItems(values:[
17665+
"srcPath": srcPath,
17666+
"dstFolder": dstFolder,
17667+
"dontOptimize": dontOptimize,
17668+
"storage": storage
17669+
])
17670+
17671+
17672+
let requestBuilder: RequestBuilder<AsposeResponse>.Type = AsposePdfCloudAPI.requestBuilderFactory.getBuilder()
17673+
17674+
return requestBuilder.init(method: "PUT", URLString: (urlObj?.string ?? URLString), parameters: parameters, isBody: false)
17675+
}
17676+
1756017677
/**
1756117678
Converts PDF document (in request content) to DOC format and uploads resulting file to storage.
1756217679

AsposePdfCloudTests/ConvertToPdfTests.swift

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,4 +707,57 @@ class ConvertToPdfTests: AsposePdfCloudTests {
707707

708708
self.waitForExpectations(timeout: testTimeout, handler: nil)
709709
}
710+
711+
// PDFA
712+
func testGetPdfAInStorageToPdf() {
713+
714+
let expectation = self.expectation(description: "testGetPdfAInStorageToPdf")
715+
let name = "4pagesPdfA.pdf"
716+
717+
uploadFile(name: name) {
718+
719+
PdfAPI.getPdfAInStorageToPdf(srcPath: "\(self.tempFolder)/\(name)") {
720+
(response, error) in
721+
guard error == nil else {
722+
XCTFail("error testGetPdfAInStorageToPdf: " + (error.debugDescription))
723+
return
724+
}
725+
726+
if let response = response {
727+
XCTAssertFalse(response.isEmpty)
728+
729+
expectation.fulfill()
730+
}
731+
}
732+
}
733+
734+
self.waitForExpectations(timeout: testTimeout, handler: nil)
735+
}
736+
737+
738+
func testPutPdfAInStorageToPdf() {
739+
740+
let expectation = self.expectation(description: "testPutPdfAInStorageToPdf")
741+
let name = "4pagesPdfA.pdf"
742+
let resultName = "fromPdfA.pdf"
743+
744+
uploadFile(name: name) {
745+
746+
PdfAPI.putPdfAInStorageToPdf(name: resultName, srcPath: "\(self.tempFolder)/\(name)", dstFolder: self.tempFolder) {
747+
(response, error) in
748+
guard error == nil else {
749+
XCTFail("error testPutPdfAInStorageToPdf: " + (error.debugDescription))
750+
return
751+
}
752+
753+
if let response = response {
754+
XCTAssertEqual(response.code, self.codeOk)
755+
756+
expectation.fulfill()
757+
}
758+
}
759+
}
760+
761+
self.waitForExpectations(timeout: testTimeout, handler: nil)
762+
}
710763
}

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Edit assembly info of a PDF document online https://products.aspose.app/pdf/asse
1717
$ gem install cocoapods
1818
```
1919

20-
> CocoaPods 1.1+ is required to build AsposePdfCloud 20.1+.
20+
> CocoaPods 1.1+ is required to build AsposePdfCloud 20.2+.
2121
2222
To integrate AsposePdfCloud into your Xcode project using CocoaPods, specify it in your `Podfile`:
2323

@@ -27,7 +27,7 @@ platform :ios, '10.0'
2727
use_frameworks!
2828

2929
target '<Your Target Name>' do
30-
pod 'AsposePdfCloud', '~> 20.1'
30+
pod 'AsposePdfCloud', '~> 20.2'
3131
end
3232
```
3333

@@ -222,6 +222,7 @@ Class | Method | HTTP request | Description
222222
*PdfApi* | [**getPageTextBoxFields**](https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-swift/tree/master/docs/PdfApi.md#getPageTextBoxFields) | **GET** /pdf/\{name}/page/\{pageNumber}/fields/textbox | Read document page text box fields.
223223
*PdfApi* | [**getPageUnderlineAnnotations**](https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-swift/tree/master/docs/PdfApi.md#getPageUnderlineAnnotations) | **GET** /pdf/\{name}/pages/\{pageNumber}/annotations/underline | Read document page underline annotations.
224224
*PdfApi* | [**getPclInStorageToPdf**](https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-swift/tree/master/docs/PdfApi.md#getPclInStorageToPdf) | **GET** /pdf/create/pcl | Convert PCL file (located on storage) to PDF format and return resulting file in response.
225+
*PdfApi* | [**getPdfAInStorageToPdf**](https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-swift/tree/master/docs/PdfApi.md#getPdfAInStorageToPdf) | **GET** /pdf/create/pdfa | Convert PDFA file (located on storage) to PDF format and return resulting file in response.
225226
*PdfApi* | [**getPdfInStorageToDoc**](https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-swift/tree/master/docs/PdfApi.md#getPdfInStorageToDoc) | **GET** /pdf/\{name}/convert/doc | Converts PDF document (located on storage) to DOC format and returns resulting file in response content
226227
*PdfApi* | [**getPdfInStorageToEpub**](https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-swift/tree/master/docs/PdfApi.md#getPdfInStorageToEpub) | **GET** /pdf/\{name}/convert/epub | Converts PDF document (located on storage) to EPUB format and returns resulting file in response content
227228
*PdfApi* | [**getPdfInStorageToHtml**](https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-swift/tree/master/docs/PdfApi.md#getPdfInStorageToHtml) | **GET** /pdf/\{name}/convert/html | Converts PDF document (located on storage) to Html format and returns resulting file in response content
@@ -375,6 +376,7 @@ Class | Method | HTTP request | Description
375376
*PdfApi* | [**putPageConvertToPng**](https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-swift/tree/master/docs/PdfApi.md#putPageConvertToPng) | **PUT** /pdf/\{name}/pages/\{pageNumber}/convert/png | Convert document page to png image and upload resulting file to storage.
376377
*PdfApi* | [**putPageConvertToTiff**](https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-swift/tree/master/docs/PdfApi.md#putPageConvertToTiff) | **PUT** /pdf/\{name}/pages/\{pageNumber}/convert/tiff | Convert document page to Tiff image and upload resulting file to storage.
377378
*PdfApi* | [**putPclInStorageToPdf**](https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-swift/tree/master/docs/PdfApi.md#putPclInStorageToPdf) | **PUT** /pdf/\{name}/create/pcl | Convert PCL file (located on storage) to PDF format and upload resulting file to storage.
379+
*PdfApi* | [**putPdfAInStorageToPdf**](https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-swift/tree/master/docs/PdfApi.md#putPdfAInStorageToPdf) | **PUT** /pdf/\{name}/create/pdfa | Convert PDFA file (located on storage) to PDF format and upload resulting file to storage.
378380
*PdfApi* | [**putPdfInRequestToDoc**](https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-swift/tree/master/docs/PdfApi.md#putPdfInRequestToDoc) | **PUT** /pdf/convert/doc | Converts PDF document (in request content) to DOC format and uploads resulting file to storage.
379381
*PdfApi* | [**putPdfInRequestToEpub**](https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-swift/tree/master/docs/PdfApi.md#putPdfInRequestToEpub) | **PUT** /pdf/convert/epub | Converts PDF document (in request content) to EPUB format and uploads resulting file to storage.
380382
*PdfApi* | [**putPdfInRequestToHtml**](https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-swift/tree/master/docs/PdfApi.md#putPdfInRequestToHtml) | **PUT** /pdf/convert/html | Converts PDF document (in request content) to Html format and uploads resulting file to storage.

TestData/4pagesPdfA.pdf

585 KB
Binary file not shown.

0 commit comments

Comments
 (0)