Set Embedded Fonts from a Request Introduction
Aspose.Slides Cloud API allows embedding a font used in a presentation. The font can be provided in the request body if needed. The feature can be applied to presentations located in the storage or presentations uploaded in the request body along with the font file.
SetEmbeddedFontFromRequest
API
Type
Description
Resource
/slides/{name}/fonts/embedded
POST
Embeds font from request and returns presentation fonts info.
SetEmbeddedFontFromRequest
Examples
cURL Example
The code examples below show how to embed fonts in a presentation located in the storage.
SDK Examples
C#
SlidesApi api = new SlidesApi ( "MyClientId" , "MyClientSecret" );
Stream fontFile = File . OpenRead ( "calibri.ttf" );
FontsData response = api . SetEmbeddedFontFromRequest ( fontFile , "MyPresentation.pptx" , false );
Console . WriteLine ( "Font " + response . List [ 2 ]. FontName + " has been embedded." );
Java
SlidesApi api = new SlidesApi ( "MyClientId" , "MyClientSecret" );
byte [] file = Files . readAllBytes ( Paths . get ( "calibri.ttf" ));
FontsData response = api . setEmbeddedFontFromRequest ( file , "MyPresentation.pptx" , false , null , null , null );
System . out . println ( "Font " + response . getList (). get ( 2 ). getFontName () + " has been embedded." );
PHP
use Aspose\Slides\Cloud\Sdk\Api\Configuration ;
use Aspose\Slides\Cloud\Sdk\Api\SlidesApi ;
use Aspose\Slides\Cloud\Sdk\Model\FontsData ;
$config = new Configuration ();
$config -> setAppSid ( "MyClientId" );
$config -> setAppKey ( "MyClientSecret" );
$api = new SlidesApi ( null , $config );
$file = fopen ( "calibri.ttf" , 'r' );
$result = $api -> setEmbeddedFontFromRequest ( $file , "MyPresentation.pptx" , false );
print ( "Font " . $result -> getList ()[ 2 ] -> getFontName () . " has been embedded." );
Ruby
configuration = AsposeSlidesCloud :: Configuration . new
configuration . app_sid = "MyClientId"
configuration . app_key = "MyClientSecret"
api = AsposeSlidesCloud :: SlidesApi . new ( configuration )
source = File . binread ( "calibri.ttf" )
response = api . set_embedded_font_from_request ( source , "MyPresentation.pptx" , false )
print "Font " + response . list [ 2 ]. font_name + " has been embedded."
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 )
with open ( "calibri.ttf" , 'rb' ) as f :
source = f . read ()
response = api . set_embedded_font_from_request ( source , "MyPresentation.pptx" , False )
print ( "Font " + response . list [ 2 ] . font_name + " has been embedded." )
Node.js
const CloudSdk = require ( "asposeslidescloud" );
const fs = require ( "fs" );
const api = new CloudSdk . SlidesApi ( "MyClientId" , "MyClientSecret" );
const stream = fs . createReadStream ( "calibri.ttf" );
let result = await api . setEmbeddedFontFromRequest ( stream , "MyPresentation.pptx" , false );
console . log ( "Font " + result . body . list [ 2 ]. fontName + " has been embedded." );
Go
cfg := asposeslidescloud . NewConfiguration ()
cfg . AppSid = "MyClientId"
cfg . AppKey = "MyClientSecret"
api := asposeslidescloud . NewAPIClient ( cfg )
document , e := ioutil . ReadFile ( "calibri.ttf" )
var onlyUsed bool = false
response , _ , e := api . SlidesApi . SetEmbeddedFontFromRequest ( document , "MyPresentation.pptx" , & onlyUsed , "" , "" , "" )
if e != nil {
fmt . Printf ( "Error: %v." , e )
return
}
fmt . Printf ( "Font " + response . GetList ()[ 2 ]. GetFontName () + " has been embedded." )
C++
Perl
use AsposeSlidesCloud::Configuration ;
use AsposeSlidesCloud::SlidesApi ;
use AsposeSlidesCloud::Object::SlideComment ;
my $config = AsposeSlidesCloud::Configuration -> new ();
$config -> { app_sid } = "MyClientId" ;
$config -> { app_key } = "MyClientSecret" ;
my $api = AsposeSlidesCloud::SlidesApi -> new ( config => $config );
#Code example will be added soon.
Swift
SetEmbeddedFontFromRequestOnline
Examples
cURL Example
The code examples below show how to embed fonts in a presentation located in the request body.
SDK Examples
C#
SlidesApi api = new SlidesApi ( "MyClientId" , "MyClientSecret" );
Stream file = File . OpenRead ( "MyPresentation.pptx" );
Stream fontFile = File . OpenRead ( "calibri.ttf" );
Stream response = api . SetEmbeddedFontFromRequestOnline ( file , fontFile , false );
Console . WriteLine ( "Font Calibri has been embedded." );
Java
SlidesApi api = new SlidesApi ( "MyClientId" , "MyClientSecret" );
byte [] file = Files . readAllBytes ( Paths . get ( "MyPresentation.pptx" ));
byte [] fontFile = Files . readAllBytes ( Paths . get ( "calibri.ttf" ));
File response = api . setEmbeddedFontFromRequestOnline ( file , fontFile , false , null );
System . out . println ( "Font Calibri has been embedded." );
PHP
use Aspose\Slides\Cloud\Sdk\Api\Configuration ;
use Aspose\Slides\Cloud\Sdk\Api\SlidesApi ;
use Aspose\Slides\Cloud\Sdk\Model\FontsData ;
$config = new Configuration ();
$config -> setAppSid ( "MyClientId" );
$config -> setAppKey ( "MyClientSecret" );
$api = new SlidesApi ( null , $config );
$file = fopen ( "MyPresentataion.pptx" , 'r' );
$fontFile = fopen ( "calibri.ttf" , 'r' );
$result = $api -> setEmbeddedFontFromRequestOnline ( $file , $fontFile , false );
print ( "Font Calibri has been embedded." );
Ruby
configuration = AsposeSlidesCloud :: Configuration . new
configuration . app_sid = "MyClientId"
configuration . app_key = "MyClientSecret"
api = AsposeSlidesCloud :: SlidesApi . new ( configuration )
source = File . binread ( "MyPresentation.pptx" )
fontSource = File . binread ( "calibri.ttf" )
response = api . set_embedded_font_from_request_online ( source , fontSource , false )
print "Font Calibri has been embedded."
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 )
with open ( "MyPresentation.pptx" , 'rb' ) as f :
source = f . read ()
with open ( "calibri.ttf" , 'rb' ) as f :
fontsource = f . read ()
response = api . set_embedded_font_from_request_online ( source , fontsource , False )
print ( "Font Calibri has been embedded." )
Node.js
const CloudSdk = require ( "asposeslidescloud" );
const fs = require ( "fs" );
const api = new CloudSdk . SlidesApi ( "MyClientId" , "MyClientSecret" );
const stream = fs . createReadStream ( "MyPresentation.pptx" );
const fontStream = fs . createReadStream ( "calibri.ttf" );
let reponse = await api . setEmbeddedFontFromRequestOnline ( stream , fontStream , false );
console . log ( "Font Calibri has been embedded." );
Go
cfg := asposeslidescloud . NewConfiguration ()
cfg . AppSid = "MyClientId"
cfg . AppKey = "MyClientSecret"
api := asposeslidescloud . NewAPIClient ( cfg )
document , e := ioutil . ReadFile ( "MyPresentation.pptx" )
fontFile , e := ioutil . ReadFile ( "calibri.ttf" )
var onlyUsed bool = false
_ , _ , e = api . SlidesApi . SetEmbeddedFontFromRequestOnline ( document , fontFile , & onlyUsed , "" )
if e != nil {
fmt . Printf ( "Error: %v." , e )
return
}
fmt . Printf ( "Font Calibri has been embedded." )
C++
Perl
use AsposeSlidesCloud::Configuration ;
use AsposeSlidesCloud::SlidesApi ;
use AsposeSlidesCloud::Object::SlideComment ;
my $config = AsposeSlidesCloud::Configuration -> new ();
$config -> { app_sid } = "MyClientId" ;
$config -> { app_key } = "MyClientSecret" ;
my $api = AsposeSlidesCloud::SlidesApi -> new ( config => $config );
#Code example will be added soon.
Swift
SDK Source
The Aspose for Cloud SDKs can be downloaded from the following page: Available SDKs