Swift API för att konvertera BMP till SVG
Swift-bibliotek för att konvertera BMP till SVG
Konvertera en BMP-fil till SVG i Swift
API
PUT
https://api.aspose.cloud/v3.0/cells/convert
Att konvertera filformat från BMP till SVG är en komplex uppgift. Alla formatövergångar från BMP till SVG utförs av vår Swift SDK samtidigt som källbladets BMP kalkylblads huvudsakliga strukturella och logiska innehåll bibehålls. Vårt Swift-bibliotek är en professionell lösning för att konvertera BMP till SVG filer online. Denna Cloud SDK ger Swift-utvecklare kraftfull funktionalitet och perfekt SVG-utgång.
Kodexempel i Swift med REST API för att konvertera formatet BMP till SVG
// For complete examples and data files, please go to https://github.com/aspose-cells-cloud/aspose-cells-cloud-swift/
import AsposeCellsCloud
let expectation1 = self.expectation(description: "checkAuth")
AsposeCellsCloudAPI.clientId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
AsposeCellsCloudAPI.clientSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
AuthAspose.checkAuth()
{
(authError) in
guard authError == nil else {
XCTFail("error checkAuth")
return
}
expectation1.fulfill()
}
self.waitForExpectations(timeout: testTimeout, handler: nil)
let expectation = self.expectation(description: "PutConvert")
let workbook:String = "Book1.bmp"
let format:String? = "svg"
let url1: URL? = getURL(workbook)
let filedata = NSData(contentsOfFile: url1!.path)
let password:String? = nil
let outPath:String? = nil
CellsAPI.cellsWorkbookPutConvertWorkbook(file: url1!, format: format, password: password, outPath: outPath)
{
(response, error) in
guard error == nil else {
let errorinfo = self.GetErrorDataInfo(error: error as! ErrorResponse)
print("error info: \(errorinfo!)")
XCTFail("error PutConvert")
return
}
if let response = response {
//response is a Data of file, we may write it down and check it.
let fileName = "dest.svg"
let filePath = NSHomeDirectory()
let fileManager = FileManager.default
let path = "\(filePath)/tmp/\(fileName)"
fileManager.createFile(atPath: path, contents:nil, attributes:nil)
let handle = FileHandle(forWritingAtPath:path)
handle?.write(response as Data)
expectation.fulfill()
}
}
self.waitForExpectations(timeout: testTimeout, handler: nil)
Hur man använder Swift API för att konvertera BMP till SVG
- Skapa ett konto påinstrumentbräda för att få gratis API kvot & auktoriseringsinformation
- Initiera CellsApi med klient-id, klienthemlighet, basadress och version API
- Anrop cellsWorkbookPutConvertWorkbook-metoden för att få den resulterande strömmen
Systemkrav
- macOS Monterey 12.4
- Swift 4.2