Swift API zum Konvertieren von PNG in BMP

Swift-Bibliothek zum Konvertieren von PNG in BMP

Verwenden Sie Cells Conversion REST API, um benutzerdefinierte Tabellenkalkulations-Workflows in Swift zu erstellen. Dies ist eine professionelle Lösung, um PNG in BMP und andere Dokumentformate online mit Swift zu konvertieren.

Konvertieren Sie eine PNG-Datei in Swift in BMP

API
PUT
https://api.aspose.cloud/v3.0/cells/convert

Das Konvertieren von Dateiformaten von PNG in BMP ist eine komplexe Aufgabe. Alle Formatübergänge von PNG zu BMP werden von unserem Swift SDK durchgeführt, wobei der strukturelle und logische Hauptinhalt der Quelltabelle PNG erhalten bleibt. Unsere Swift-Bibliothek ist eine professionelle Lösung zum Online-Konvertieren von PNG- in BMP-Dateien. Dieses Cloud SDK bietet Swift-Entwicklern leistungsstarke Funktionalität und eine perfekte BMP-Ausgabe.

Codebeispiel in Swift mit REST API zum Konvertieren des Formats PNG in das Format BMP

// 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.png"
    let format:String? = "bmp"     
    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.bmp"
            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)


So verwenden Sie Swift API, um PNG in BMP zu konvertieren

  1. Erstellen Sie ein Konto unterArmaturenbrett um ein kostenloses API-Kontingent und Autorisierungsdetails zu erhalten
  2. Initialisieren Sie CellsApi mit Client-ID, Client-Geheimnis, Basis-URL und Version API
  3. Rufen Sie die Methode „cellsWorkbookPutConvertWorkbook“ auf, um den resultierenden Stream abzurufen


System Anforderungen

  1. macOS Monterey 12.4
  2. Swift 4.2