HTML Rendering & Conversion Swift Cloud REST API
Aspose.HTML Cloud for Swift is a programming SDK that allows software developers to manipulate and convert HTML documents from within their own applications. A Wrapper of RESTful APIs, Aspose.HTML Cloud for Swift speeds up HTML programming and conversion. This cloud SDK assists to develop cloud-based HTML page rendering, processing, translation & conversion apps in Swift via REST API.
HTML Processing Features
- Fetch the HTML page along with its resources as a ZIP archive by providing the page URL.
- Based on page URL, retrieve all images of an HTML page as a ZIP package.
- Load data from a local file to populate the HTML document template.
- Use the request body to populate the HTML document template.
- Convert HTML page to numerous other file formats.
Read & Write HTML Formats
HTML, XHTML, zipped HTML, zipped XHTML, MHTML, HTML containing SVG markup, Markdown, JSON
Save HTML As
Fixed Layout: PDF, XPS Images: TIFF, JPEG, PNG, BMP, GIF Other: TXT, ZIP (images)
Read HTML Formats
eBook: EPUB Other: XML, SVG
Enhancements Version 20.11
- New generation of Aspose.HTML Cloud SDK for .NET (C#) is provided.
- This version of SDK has been redesigned from scratch being based on the new Aspose.HTML Cloud REST API (v3.0).
- Currently, it provides only the conversion feature. Other features that are still available in the versions up to v.20.08 are planned to be implemented in this SDK later.
- Conversion interface provides a more flexible conversion parameters setup.
- Redesigned storage access is provided using SDK entry point HtmlApi.Storage.
- Availability of synchronous and asynchronous file upload and download methods.
- Asynchronous download provides the ability to get progress data for the longer downloads.
How to use the SDK?
The complete source code is available in this repository folder, you can either directly use it in your project.
Requirements
- mac OS X 10.12.6
- XCode 9.2
- Swift 5.1 and later
- Alamofire 4.9.1 and later
Prerequisites
To use Aspose HTML for Cloud SDK you need to register an account with Aspose Cloud and lookup/create App Key and SID at Cloud Dashboard. There is free quota available. For more details, see Aspose Cloud Pricing.
Installation & Usage
Getting Started
Before create configuration, then use HtmlAPI or StorageAPI (see tests)
Example:
ClientAPI.setConfig(
basePath: "https://api.aspose.cloud/v3.0",
authPath: "https://api.aspose.cloud/connect/token",
apiKey: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
appSID: "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
debugging: true
)
Documentation for API Endpoints
All URIs are relative to https://api.aspose.cloud/v3.0
Class | Method | HTTP request | Description |
---|---|---|---|
HtmlAPI | getConvertDocumentToImage | GET /html/{name}/convert/image/{outFormat} | Convert the HTML document from the storage by its name to the specified image format. |
HtmlAPI | getConvertDocumentToImageByUrl | GET /html/convert/image/{outFormat} | Convert the HTML page from the web by its URL to the specified image format. |
HtmlAPI | getConvertDocumentToPdf | GET /html/{name}/convert/pdf | Convert the HTML document from the storage by its name to PDF. |
HtmlAPI | getConvertDocumentToPdfByUrl | GET /html/convert/pdf | Convert the HTML page from the web by its URL to PDF. |
HtmlAPI | getConvertDocumentToXps | GET /html/{name}/convert/xps | Convert the HTML document from the storage by its name to XPS. |
HtmlAPI | getConvertDocumentToXpsByUrl | GET /html/convert/xps | Convert the HTML page from the web by its URL to XPS. |
HtmlAPI | postConvertDocumentInRequestToImage | POST /html/convert/image/{outFormat} | Converts the HTML document (in request content) to the specified image format and uploads resulting file to storage. |
HtmlAPI | postConvertDocumentInRequestToPdf | POST /html/convert/pdf | Converts the HTML document (in request content) to PDF and uploads resulting file to storage. |
HtmlAPI | postConvertDocumentInRequestToXps | POST /html/convert/xps | Converts the HTML document (in request content) to XPS and uploads resulting file to storage. |
HtmlAPI | putConvertDocumentToImage | PUT /html/{name}/convert/image/{outFormat} | Converts the HTML document (located on storage) to the specified image format and uploads resulting file to storage. |
HtmlAPI | putConvertDocumentToPdf | PUT /html/{name}/convert/pdf | Converts the HTML document (located on storage) to PDF and uploads resulting file to storage. |
HtmlAPI | putConvertDocumentToXps | PUT /html/{name}/convert/xps | Converts the HTML document (located on storage) to XPS and uploads resulting file to storage. |
HtmlAPI | getConvertDocumentToMHTMLByUrl | GET /html/convert/mhtml | Converts the HTML page from Web by its URL to MHTML returns resulting file in response content. |
HtmlAPI | getConvertDocumentToMarkdown | GET /html/{name}/convert/md | Converts the HTML document (located on storage) to Markdown and returns resulting file in response content. |
HtmlAPI | postConvertDocumentInRequestToMarkdown | POST /html/convert/md | Converts the HTML document (in request content) to Markdown and uploads resulting file to storage by specified path. |
HtmlAPI | putConvertDocumentToMarkdown | PUT /html/{name}/convert/md | Converts the HTML document (located on storage) to Markdown and uploads resulting file to storage by specified path. |
HtmlAPI | getConvertMarkdownToHtml | GET /html/{name}/import/md | Converts the Markdown document (located on storage) to HTML and returns resulting file in response content. |
HtmlAPI | postConvertMarkdownInRequestToHtml | POST /html/import/md | Converts the Markdown document (in request content) to HTML and uploads resulting file to storage by specified path. |
HtmlAPI | putConvertMarkdownToHtml | PUT /html/{name}/import/md | Converts the Markdown document (located on storage) to HTML and uploads resulting file to storage by specified path. |
HtmlAPI | getDocumentByUrl | GET /html/download | Return all HTML page with linked resources packaged as a ZIP archive by the source page URL. |
HtmlAPI | getDocumentFragmentByXPath | GET /html/{name}/fragments/{outFormat} | Return list of HTML fragments matching the specified XPath query. |
HtmlAPI | getDocumentFragmentByXPathByUrl | GET /html/fragments/{outFormat} | Return list of HTML fragments matching the specified XPath query by the source page URL. |
HtmlAPI | getDocumentFragmentsByCSSSelector | GET /html/{name}/fragments/css/{outFormat} | Return list of HTML fragments matching the specified CSS selector. |
HtmlAPI | getDocumentFragmentsByCSSSelectorByUrl | GET /html/fragments/css/{outFormat} | Return list of HTML fragments matching the specified CSS selector by the source page URL. |
HtmlAPI | getDocumentImages | GET /html/{name}/images/all | Return all HTML document images packaged as a ZIP archive. |
HtmlAPI | getDocumentImagesByUrl | GET /html/images/all | Return all HTML page images packaged as a ZIP archive by the source page URL. |
HtmlAPI | getMergeHtmlTemplate | GET /html/{templateName}/merge | Populate HTML document template with data located as a file in the storage. |
HtmlAPI | postMergeHtmlTemplate | POST /html/{templateName}/merge | Populate HTML document template with data from the request body. Result document will be saved to storage. |
HtmlAPI | getSeoWarning | GET /html/seo | Page analysis and return SEO warnings in json format. |
HtmlAPI | getHtmlWarning | GET /html/validator | Checks the markup validity of Web documents in HTML, XHTML, etc.and return in json format. |
Documentation For Authorization
oauth
- Type: OAuth2
- Flow: application
- Authorization URL: "https://api.aspose.cloud/connect/token"
- Scopes: N/A
Examples
Test uses StorageApi for upload(download) file to(from) remote storage.
Documentation for Storage API Endpoints
All URIs are relative to https://api.aspose.cloud/v3.0
Class | Method | HTTP request | Description |
---|---|---|---|
StorageAPI | copyFile | PUT /html/storage/file/copy/{srcPath} | Copy file |
StorageAPI | deleteFile | DELETE /html/storage/file/{path} | Delete file |
StorageAPI | downloadFile | GET /html/storage/file/{path} | Download file |
StorageAPI | moveFile | PUT /html/storage/file/move/{srcPath} | Move file |
StorageAPI | uploadFile | PUT /html/storage/file/{path} | Upload file |
StorageAPI | copyFolder | PUT /html/storage/folder/copy/{srcPath} | Copy folder |
StorageAPI | createFolder | PUT /html/storage/folder/{path} | Create the folder |
StorageAPI | deleteFolder | DELETE /html/storage/folder/{path} | Delete folder |
StorageAPI | getFilesList | GET /html/storage/folder/{path} | Get all files and folders within a folder |
StorageAPI | moveFolder | PUT /html/storage/folder/move/{srcPath} | Move folder |
StorageAPI | getDiscUsage | GET /html/storage/disc | Get disc usage |
StorageAPI | getFileVersions | GET /html/storage/version/{path} | Get file versions |
StorageAPI | objectExists | GET /html/storage/exist/{path} | Check if file or folder exists |
StorageAPI | storageExists | GET /html/storage/{storageName}/exist | Check if storage exists |
Documentation for Models
- DiscUsage
- ErrorDetails
- FilesList
- FilesUploadResult
- FileVersion
- FileVersions
- ModelError
- ObjectExist
- StorageExist
- StorageFile
Tests contain various examples of using the Aspose.HTML and Aspose.Storage SDK.
Aspose.HTML Cloud SDKs in Popular Languages
.NET | Java | PHP | Python | Ruby | Node.js | Android | Swift | C++ | Go |
---|---|---|---|---|---|---|---|---|---|
GitHub | GitHub | GitHub | GitHub | GitHub | GitHub | GitHub | GitHub | GitHub | GitHub |
NuGet | Maven | Composer | PIP | GEM | NPM | Maven | Cocoapods | NuGet | Go.Dev |
Product Page | Documentation | API Reference | Code Samples | Blog | Free Support | Free Trial