Export a Math Formula Introduction
You can export (download or save to the storage) math formulas in MathML format. You use mathMl subresource of portion resource for that. You can not export ordinary text portions for which MathParagraph property is not set. You will get an exception if you try to export such a portion.
API
Type
Description
Resource Link
/slides/{name}/slides/{slideIndex}/shapes/{shapeIndex}/paragraphs/{paragraphIndex}/portions/{portionIndex}/{format}
POST
Converts math formula to MathML or LaTeX format.
DownloadMathPortion
/slides/{name}/slides/{slideIndex}/shapes/{shapeIndex}/paragraphs/{paragraphIndex}/portions/{portionIndex}/{format}
PUT
Converts math formula to MathML or LaTeX format and saves result to the storage.
SaveMathPortion
Request Parameters
Parameter Name
HTTP Method(s)
Type
Optional/Required
Description
folder
POST/PUT
string (query)
Optional
Presentation folder.
storage
POST/PUT
string (query)
Optional
Presentation storage.
password
POST/PUT
string (header)
Optional
Presentation password.
outPath
PUT
string (query)
Required
A path to save the result.
In case of Amazon S3 storage folder path starts with Amazon S3 bucket name.
cURL Example
SDKs
Using an SDK (API client) is the quickest way for a developer to speed up the development. An SDK takes care of a lot of low-level details of making requests and handling responses and lets you focus on writing code specific to your particular project. Check out our GitHub repository for a complete list of Aspose.Slides Cloud SDKs along with working examples, to get you started in no time. Please check Available SDKs article to learn how to add an SDK to your project.
SDK Examples
C#
string fileName = "MyPresentation.pptx" ;
int slideIndex = 2 ;
int shapeIndex = 3 ;
int paragraphIndex = 1 ;
int portionIndex = 1 ;
SlidesApi api = new SlidesApi ( "MyClientId" , "MyClientSecret" );
using Stream mathMl = api . DownloadMathPortion ( fileName , slideIndex , shapeIndex , paragraphIndex , portionIndex , MathFormat . MathML );
using Stream fileStream = File . Open ( "equation.xml" , FileMode . Create );
mathMl . CopyTo ( fileStream );
Java
String fileName = "MyPresentation.pptx" ;
int slideIndex = 2 ;
int shapeIndex = 3 ;
int paragraphIndex = 1 ;
int portionIndex = 1 ;
SlidesApi api = new SlidesApi ( "MyClientId" , "MyClientSecret" );
File mathMl = api . downloadMathPortion ( fileName , slideIndex , shapeIndex , paragraphIndex , portionIndex , MathFormat . MATHML , null , null , null );
System . out . println ( "The converted file was saved to " + mathMl . getPath ());
PHP
use Aspose\Slides\Cloud\Sdk\Api\Configuration ;
use Aspose\Slides\Cloud\Sdk\Api\SlidesApi ;
$config = new Configuration ();
$config -> setAppSid ( "MyClientId" );
$config -> setAppKey ( "MyClientSecret" );
$api = new SlidesApi ( null , $config );
$fileName = "MyPresentation.pptx" ;
$slideIndex = 2 ;
$shapeIndex = 3 ;
$paragraphIndex = 1 ;
$portionIndex = 1 ;
$mathMl = $api -> downloadMathPortion ( $fileName , $slideIndex , $shapeIndex , $paragraphIndex , $portionIndex , "MathML" );
print ( "The converted file was saved to " . $mathMl -> getPathname ());
Python
import asposeslidescloud
from asposeslidescloud.configuration import Configuration
from asposeslidescloud.apis.slides_api import SlidesApi
configuration = Configuration ()
configuration . app_sid = 'MyClientId'
configuration . app_key = 'MyClientSecret'
api = SlidesApi ( configuration )
file_name = "MyPresentation.pptx"
slide_index = 2
shape_index = 3
paragraph_index = 1
portion_index = 1
mathMl = api . download_math_portion ( file_name , slide_index , shape_index , paragraph_index , portion_index , "MathML" )
print ( 'The converted file was saved to ' + mathMl )
Node.js
const CloudSdk = require ( "asposeslidescloud" );
const fs = require ( "fs" );
const api = new CloudSdk . SlidesApi ( "MyClientId" , "MyClientSecret" );
const fileName = "MyPresentation.pptx" ;
const slideIndex = 2 ;
const shapeIndex = 3 ;
const paragraphIndex = 1 ;
const portionIndex = 1 ;
api . downloadMathPortion ( fileName , slideIndex , shapeIndex , paragraphIndex , portionIndex , "MathML" ). then ( result => {
fs . writeFile ( "equation.xml" , result . body , ( err ) => {
if ( err ) throw err ;
});
});
Go
cfg := asposeslidescloud . NewConfiguration ()
cfg . AppSid = "MyClientId"
cfg . AppKey = "MyClientSecret"
api := asposeslidescloud . NewAPIClient ( cfg )
fileName := "MyPresentation.pptx"
var slideIndex int32 = 2
var shapeIndex int32 = 3
var paragraphIndex int32 = 1
var portionIndex int32 = 1
mathMl , _ , e := api . SlidesApi . DownloadMathPortion ( fileName , slideIndex , shapeIndex , paragraphIndex , portionIndex , "MathML" , "" , "" , "" )
if e != nil {
fmt . Printf ( "Error: %v." , e )
return
}
fmt . Printf ( "The converted file was saved to %v." , mathMl . Name ())
SDK Source
The Aspose Cloud SDK’s can be downloaded from the following page: Available SDK’s