Our powerful Swift SDK allows you to find the difference between PDF documents and save the results to a convenient format for viewing. To verify our product capabilities, compare PDF files using this Swift library and see the differences.
Our Swift SDK is designed to give you the most accurate result, even though comparison is a complex function itself.
Sometimes you need to be sure that the document in the PDF format has not been changed, and if it has, you need to find out what the difference is. Just use our Swift diff tool to compare two PDF files and find differences in whole words or single characters. Moreover, if only one character in a word has changed, this word will be marked as changed entirely.
Now you no longer need to spend time manually comparing PDF documents, and you can quickly find even small changes and export such diffs to a document in a convenient format.
Check out how our solution to compare PDF files using Swift SDK works. To achieve this, load the PDF files you want to compare and select the export file format – it will be automatically loaded after comparing.
Note that you need to accept all revisions in compared documents before calling the comparison method, as shown in our example:
import AsposeWordsCloud
let config =
Configuration(clientId: "####-####-####-####-####", clientSecret: "##################");
let api = try WordsAPI(configuration: config);
let fileName1 = "Input1.pdf";
let fileName2 = "Input2.pdf";
let fileResult = "Output.pdf";
// Upload documents to cloud storage.
let firstDocumentContent = InputStream(url: URL(string: fileName1))!;
let uploadFirstFileRequest =
UploadFileRequest(fileContent: firstDocumentContent, path: fileName1);
_ = try api.uploadFile(request: uploadFirstFileRequest);
let secondDocumentContent = InputStream(url: URL(string: fileName2))!;
let uploadSecondFileRequest =
UploadFileRequest(fileContent: secondDocumentContent, path: fileName2);
_ = try api.uploadFile(request: uploadSecondFileRequest);
// Compare documents in cloud.
let compareDataOptions = CompareData()
.setAuthor(author: "author")
.setFileReference(fileReference: FileReference(remoteFilePath: fileName2));
let compareDocumentRequest =
CompareDocumentRequest(name: fileName1, compareData: compareDataOptions,
destFileName: fileResult);
_ = try api.compareDocument(request: compareDocumentRequest);
// Download result document from cloud storage.
let downloadFileRequest = DownloadFileRequest(path: fileResult);
let downloadFileResult = try api.downloadFile(request: downloadFileRequest);
try downloadFileResult?.first?.value.write(
to: currentDir!.appendingPathComponent(fileResult, isDirectory: false));
You can use Swift package manager and Cocoapods dependency manager to install Aspose.Words Cloud SDK for Swift. Detailed information on installing the package is given in the "Installation and Usage" section.
As an alternative, you can clone Aspose.Words Cloud SDK for Swift source code from GitHub and use it in your project.
Please follow these Instructions to quickly get the necessary security credentials and access our REST API.
You can perform compare operation for other file formats: