Aspose Document Conversion

Cloudinary is a cloud-based service that provides an end-to-end image management solution including uploads, storage, manipulations, optimizations and delivery.

Cloudinary offers a rich set of image transformation and format conversion capabilities. Cloudinary allows you to upload images and non-image raw files to the cloud. Images and PDF files can be converted to various image formats and can be cropped on-the-fly and further manipulated to match the graphic design of your websites and mobile applications.

Aspose is a leading vendor of development components, including a powerful set of file management and conversion products. Cloudinary provides an add-on for using Aspose's Office document conversion capabilities, fully integrated into Cloudinary's image management and manipulation pipeline.

With Aspose's document conversion add-on, you can extend Cloudinary's powerful format conversion and image manipulation capabilities with automatic conversion of your Microsoft Office documents, spreadsheets and presentations to PDF documents and image thumbnails.

Getting started

Before you can use the Aspose Document Conversion add-on:

  • You must have a Cloudinary account. If you don't already have one, you can sign up for a free account.

  • Register for the add-on: make sure you're logged in to your account and then go to the Add-ons page. For more information about add-on registrations, see Registering for add-ons.

  • Keep in mind that many of the examples on this page use our SDKs. For SDK installation and configuration details, see the relevant SDK guide.

  • If you are new to Cloudinary, you may want to take a look at How to integrate Cloudinary in your app for a walk through on the basics of creating and setting up your account, working with SDKs, and then uploading, transforming and delivering assets.

Convert Office documents

When you apply the Aspose add-on while uploading or updating a Microsoft Office file, the add-on converts the file to an image of type PDF and stores the converted file in addition to your original raw Office file.

Notes

  • Make sure to embed any custom fonts in the original file.
  • The Aspose add-on supports converting files up to 10 MB.

Supported Office file formats

The following Office file formats are supported:
doc, docx, docm, dotx, rtf, txt, xls, xlsx, xlsm, pot, potm, potx, pps, ppsm, pptx, ppt, and pptm.

Converting Office files on upload

To convert a document using the Aspose add-on while uploading the original Office file, set the raw_convert parameter of your upload command to aspose. Additionally, make sure to set resource_type parameter to either raw or auto (instructing Cloudinary to automatically detect that the file is a non-image raw file).

Ruby:
Copy to clipboard
Cloudinary::Uploader.upload("my_file_name.docx",
  :public_id => "sample_document.docx",
  :resource_type => 'raw', 
  :raw_convert => 'aspose')
PHP v1:
Copy to clipboard
\Cloudinary\Uploader::upload("my_file_name.docx", [
   "public_id" => "sample_document.docx",
   "resource_type" => "raw",
   "raw_convert" => "aspose"]);
PHP v2:
Copy to clipboard
$cloudinary->uploadApi()->upload("my_file_name.docx",[
   "public_id" => "sample_document.docx",
   "resource_type" => "raw",
   "raw_convert" => "aspose"]);
Python:
Copy to clipboard
cloudinary.uploader.upload("my_file_name.docx",
  public_id = "sample_document.docx",
  resource_type = "raw",
  raw_convert = "aspose")
Node.js:
Copy to clipboard
cloudinary.v2.uploader.upload("my_file_name.docx",
  { public_id: "sample_document.docx",
    resource_type: "raw",
    raw_convert: "aspose" },
  function(error, result){console.log(result);});
Java:
Copy to clipboard
cloudinary.uploader().upload("my_file_name.docx", 
  ObjectUtils.asMap(
    "public_id", "sample_document.docx",
    "resource_type", "raw",
    "raw_convert", "aspose"));
.NET:
Copy to clipboard
var uploadParams = new RawUploadParams(){
  File = new FileDescription(@"my_file_name.docx"),
  PublicId = "sample_document.docx",
  RawConvert = "aspose"};
var uploadResult = cloudinary.Upload(uploadParams);
iOS:
Copy to clipboard
let params = CLDUploadRequestParams()
  .setRawConvert("aspose")
  .setPublicId("sample_document.docx")
  .setResourceType(.raw)
var mySig = MyFunction(params)  // your own function that returns a signature generated on your backend
params.setSignature(CLDSignature(signature: mySig.signature, timestamp: mySig.timestamp))
let request = cloudinary.createUploader().signedUpload(
  url: "my_file_name.docx", params: params)
Android:
Copy to clipboard
MediaManager.get().upload("my_file_name.docx")
  .option("public_id", "sample_document.docx")
  .option("resource_type", "raw")
  .option("raw_convert", "aspose").dispatch();

Tip
You can use upload presets to centrally define a set of upload options including add-on operations to apply, instead of specifying them in each upload call. You can define multiple upload presets, and apply different presets in different upload scenarios. You can create new upload presets in the Upload page of the Management Console settings or using the upload_presets Admin API method. From the Upload page of the console settings, you can also select default upload presets to use for image, video, and raw API uploads (respectively) as well as default presets for image, video, and raw uploads performed via the Media Library UI.

Learn more: Upload presets

Document conversion using the Aspose add-on is performed asynchronously in the background after the upload call is completed. Therefore, the response of the uploaded request mentions that the Aspose raw convert process is in the pending status.

Copy to clipboard
{
 "public_id":"sample_document.docx",
 "version":1393687686,
 "resource_type":"raw",
 "type":"upload",
 "url":"http://res.cloudinary.com/demo/raw/upload/v1399208539/sample_document.docx",
 "info":{"raw_convert":{"aspose":{"status":"pending"}}},
  ...
}

As a result of the upload example above, the uploaded Microsoft Office (raw) file with the public ID of 'sample_document.docx', is immediately available for delivery as-is using the following CDN URL:

Copy to clipboard
https://res.cloudinary.com/demo/raw/upload/sample_document.docx

When the Aspose document conversion is completed, a new PDF asset with delivery type image is also created in your Cloudinary account. The image asset has the same public ID as the uploaded raw document, including the extension: 'sample_document.docx' in the above example. Because it is now an image (PDF), you can transform and deliver the generated image resource in any image format, the same way you would transform any standard image that was uploaded to Cloudinary.

The following sample code creates an HTML image tag with a Cloudinary URL that generates a PNG image of the uploaded Word document.

Ruby:
Copy to clipboard
cl_image_tag("sample_document.docx.png")
PHP v1:
Copy to clipboard
cl_image_tag("sample_document.docx.png")
PHP v2:
Copy to clipboard
(new ImageTag('sample_document.docx.png'));
Python:
Copy to clipboard
CloudinaryImage("sample_document.docx.png").image()
Node.js:
Copy to clipboard
cloudinary.image("sample_document.docx.png")
Java:
Copy to clipboard
cloudinary.url().imageTag("sample_document.docx.png");
JS:
Copy to clipboard
cloudinary.imageTag('sample_document.docx.png').toHtml();
jQuery:
Copy to clipboard
$.cloudinary.image("sample_document.docx.png")
React:
Copy to clipboard
<Image publicId="sample_document.docx.png" >

</Image>
Vue.js:
Copy to clipboard
<cld-image publicId="sample_document.docx.png" >

</cld-image>
Angular:
Copy to clipboard
<cl-image public-id="sample_document.docx.png" >

</cl-image>
.NET:
Copy to clipboard
cloudinary.Api.UrlImgUp.BuildImageTag("sample_document.docx.png")
iOS:
Copy to clipboard
imageView.cldSetImage(cloudinary.createUrl().generate("sample_document.docx.png")!, cloudinary: cloudinary)
Android:
Copy to clipboard
MediaManager.get().url().generate("sample_document.docx.png");
Kotlin:
Copy to clipboard
cloudinary.image {
publicId("sample_document.docx.png")
}.generate()
PNG image of the document

Converting existing Office files

You can convert previously uploaded Office documents using the update Admin API method while specifying the public ID of a previously uploaded Office file and setting raw_convert to aspose.

Ruby:
Copy to clipboard
Cloudinary::Api.update("sample_spreadsheet.xls",
  :raw_convert => "aspose",
  :resource_type => :raw)
PHP v1:
Copy to clipboard
$api->update("sample_spreadsheet.xls", [
    "raw_convert" => "aspose",
    "resource_type" => "raw"]);
PHP v2:
Copy to clipboard
$api->update("sample_spreadsheet.xls",
  ["raw_convert" => "aspose",
   "resource_type" => "raw"]);
Python:
Copy to clipboard
cloudinary.api.update("sample_spreadsheet.xls",
  raw_convert = "aspose",
  resource_type = "raw")
Node.js:
Copy to clipboard
cloudinary.v2.api.update("sample_spreadsheet.xls",
  { raw_convert: "aspose",
    resource_type: "raw" },
  function(error, result){console.log(result);});
Java:
Copy to clipboard
cloudinary.api().update("sample_spreadsheet.xls", 
  ObjectUtils.asMap(
    "raw_convert", "aspose",
    "resource_type", "raw"));
.NET:
Copy to clipboard
var updateParams = new UpdateParams("sample_spreadsheet.xls"){
  RawConvert = "aspose",
  ResourceType = "raw"};
var updateResult = cloudinary.Update(updateParams);

Monitor the webhook notification

The Aspose add-on converts documents asynchronously. The conversion usually takes a few seconds, but the conversion time is dependent on the size and complexity of the converted document. As a result, you may want to get notified when the conversion process is completed.

When calling the upload or update API with aspose document conversion, you can set the notification_url parameter to a public HTTP or HTTPS URL endpoint of your online web application. Cloudinary sends a POST request to the specified endpoint when the document conversion completes.

Ruby:
Copy to clipboard
Cloudinary::Uploader.upload("my_file_name.docx",
  :public_id => "sample_document.docx",
  :resource_type => 'raw', 
  :raw_convert => 'aspose',
  :notification_url => "https://mysite.example.com/hooks")
PHP v1:
Copy to clipboard
\Cloudinary\Uploader::upload("my_file_name.docx", [
    "public_id" => "sample_document.docx",
    "resource_type" => "raw",
    "raw_convert" => "aspose",
    "notification_url" => "https://mysite.example.com/hooks"]);
PHP v2:
Copy to clipboard
$cloudinary->uploadApi()->upload("my_file_name.docx", [
    "public_id" => "sample_document.docx",
    "resource_type" => "raw",
    "raw_convert" => "aspose",
    "notification_url" => "https://mysite.example.com/hooks"]);
Python:
Copy to clipboard
cloudinary.uploader.upload("my_file_name.docx",
  public_id = "sample_document.docx",
  resource_type = "raw",
  raw_convert = "aspose",
  notification_url = "https://mysite.example.com/hooks")
Node.js:
Copy to clipboard
cloudinary.uploader.upload("my_file_name.docx",
  { public_id: "sample_document.docx",
    resource_type: "raw",
    raw_convert: "aspose",
    notification_url: "https://mysite.example.com/hooks" },
  function(error, result){console.log(result);});
Java:
Copy to clipboard
cloudinary.uploader().upload("my_file_name.docx", ObjectUtils.asMap(
  "public_id", "sample_document.docx",
  "resource_type", "raw",
  "raw_convert", "aspose",
  "notification_url", "https://mysite.example.com/hooks"));
.NET:
Copy to clipboard
var uploadParams = new RawUploadParams(){
  File = new FileDescription(@"my_file_name.docx"),
  PublicId = "sample_document.docx",
  RawConvert = "aspose",
  NotificationUrl" = "https://mysite.example.com/hooks"};
var uploadResult = cloudinary.Upload(uploadParams);
iOS:
Copy to clipboard
let params = CLDUploadRequestParams()
  .setRawConvert("aspose")
  .setPublicId("sample_document.docx")
  .setResourceType(.raw)
  .setNotificationUrl("https://mysite.example.com/hooks")
var mySig = MyFunction(params)  // your own function that returns a signature generated on your backend
params.setSignature(CLDSignature(signature: mySig.signature, timestamp: mySig.timestamp))
let request = cloudinary.createUploader().signedUpload(
  url: "my_file_name.docx", params: params)
Android:
Copy to clipboard
MediaManager.get().upload("my_file_name.docx")
  .option("public_id", "sample_document.docx")
  .option("resource_type", "raw")
  .option("raw_convert", "aspose")
  .option("notification_url", "https://mysite.example.com/hooks").dispatch();

The following JSON snippet is an example of a POST request sent to the notification URL when the document conversion is completed:

Copy to clipboard
{
  "notification_type": "info",
  "info_kind": "aspose",
  "info_status": "complete",
  "public_id": "sample_document.docx",
  "uploaded_at": "2014-03-01T15:43:08Z",
  "version": 1393688588,
  "url":
    "https://res.cloudinary.com/demo/raw/upload/v1393688588/sample_document.docx",
  "secure_url":
    "https://res.cloudinary.com/demo/raw/upload/v1393688588/sample_document.docx",
  "etag": "c558a878b3b309d42b8d97c82c6f924d"
}

The JSON content is signed using your Cloudinary account API secret. For details, see Verifying notification signatures

Deliver PDFs and images of Office documents

The Aspose add-on automatically converts raw Office documents to PDF files. You can deliver the converted PDF as you would any other PDF using Cloudinary's CDN delivery URLs. The following code example returns the PDF delivery URL of the converted Word document.

Ruby:
Copy to clipboard
cloudinary_url("sample_document.docx.pdf")
PHP v1:
Copy to clipboard
cloudinary_url("sample_document.docx.pdf" );
PHP v2:
Copy to clipboard
$cloudinary->image("sample_document.docx.pdf" );
Python:
Copy to clipboard
cloudinary.CloudinaryImage("sample_document.docx.pdf").build_url()
Node.js:
Copy to clipboard
cloudinary.url("sample_document.docx.pdf");
Java:
Copy to clipboard
cloudinary.url().generate("sample_document.docx.pdf");
.NET:
Copy to clipboard
cloudinary.UrlImgUp.BuildUrl("sample_document.docx.pdf");
iOS:
Copy to clipboard
cloudinary.createUrl().generate("sample_document.docx.pdf")
Android:
Copy to clipboard
MediaManager.get().url().generate("sample_document.docx.pdf");

The returned URL: https://res.cloudinary.com/demo/image/upload/sample_document.docx.pdf

You can also apply a variety of transformations on PDF documents. For example, the following code creates an HTML image tag with a dynamic manipulation URL that generates a small JPG 'thumbnail' image of the second page (pg_2) of the document.

Ruby:
Copy to clipboard
cl_image_tag("sample_document.docx.jpg", :transformation=>[
  {:width=>300, :crop=>"scale"},
  {:page=>2}
  ])
PHP v1:
Copy to clipboard
cl_image_tag("sample_document.docx.jpg", array("transformation"=>array(
  array("width"=>300, "crop"=>"scale"),
  array("page"=>2)
  )))
PHP v2:
Copy to clipboard
(new ImageTag('sample_document.docx.jpg'))
  ->resize(Resize::scale()->width(300))
  ->extract(Extract::getPage()->byNumber(2));
Python:
Copy to clipboard
CloudinaryImage("sample_document.docx.jpg").image(transformation=[
  {'width': 300, 'crop': "scale"},
  {'page': 2}
  ])
Node.js:
Copy to clipboard
cloudinary.image("sample_document.docx.jpg", {transformation: [
  {width: 300, crop: "scale"},
  {page: 2}
  ]})
Java:
Copy to clipboard
cloudinary.url().transformation(new Transformation()
  .width(300).crop("scale").chain()
  .page(2)).imageTag("sample_document.docx.jpg");
JS:
Copy to clipboard
cloudinary.imageTag('sample_document.docx.jpg', {transformation: [
  {width: 300, crop: "scale"},
  {page: 2}
  ]}).toHtml();
jQuery:
Copy to clipboard
$.cloudinary.image("sample_document.docx.jpg", {transformation: [
  {width: 300, crop: "scale"},
  {page: 2}
  ]})
React:
Copy to clipboard
<Image publicId="sample_document.docx.jpg" >
  <Transformation width="300" crop="scale" />
  <Transformation page="2" />
</Image>
Vue.js:
Copy to clipboard
<cld-image publicId="sample_document.docx.jpg" >
  <cld-transformation width="300" crop="scale" />
  <cld-transformation page="2" />
</cld-image>
Angular:
Copy to clipboard
<cl-image public-id="sample_document.docx.jpg" >
  <cl-transformation width="300" crop="scale">
  </cl-transformation>
  <cl-transformation page="2">
  </cl-transformation>
</cl-image>
.NET:
Copy to clipboard
cloudinary.Api.UrlImgUp.Transform(new Transformation()
  .Width(300).Crop("scale").Chain()
  .Page(2)).BuildImageTag("sample_document.docx.jpg")
iOS:
Copy to clipboard
imageView.cldSetImage(cloudinary.createUrl().setTransformation(CLDTransformation()
  .setWidth(300).setCrop("scale").chain()
  .setPage(2)).generate("sample_document.docx.jpg")!, cloudinary: cloudinary)
Android:
Copy to clipboard
MediaManager.get().url().transformation(new Transformation()
  .width(300).crop("scale").chain()
  .page(2)).generate("sample_document.docx.jpg");
Kotlin:
Copy to clipboard
cloudinary.image {
publicId("sample_document.docx.jpg")
resize(Resize.scale() {
width(300)
})
extract(Extract.getPage() {
byNumber(2)
})}.generate()
Page 2 scaled down

Important note for free accounts:
By default, free Cloudinary accounts are blocked from delivering files in PDF format for security reasons.
For details or to request that this limitation be removed for your free account, see Media delivery.

Apply additional image transformations

Office document conversion using the Aspose add-on can be combined with other image transformation capabilities.

For example, the following code scales down the fourth page of the processed Word document to a width of 300 pixels while rounding its corners, applying the sepia effect and adding a gray background. Then another uploaded image named aspose_cloud_logo is added as an overlay. The overlay is resized to a relative width of 90% of the underlying image, positioned 20 pixels from the bottom of the containing image and is made 70% semi transparent.

Ruby:
Copy to clipboard
cl_image_tag("sample_document.docx.jpg", :transformation=>[
  {:border=>"2px_solid_rgb:999", :radius=>50},
  {:width=>300, :crop=>"scale"},
  {:effect=>"sepia"},
  {:page=>4},
  {:overlay=>"aspose_cloud_logo"},
  {:flags=>"relative", :width=>0.9, :crop=>"scale"},
  {:opacity=>70},
  {:flags=>"layer_apply", :gravity=>"south", :y=>20}
  ])
PHP v1:
Copy to clipboard
cl_image_tag("sample_document.docx.jpg", array("transformation"=>array(
  array("border"=>"2px_solid_rgb:999", "radius"=>50),
  array("width"=>300, "crop"=>"scale"),
  array("effect"=>"sepia"),
  array("page"=>4),
  array("overlay"=>"aspose_cloud_logo"),
  array("flags"=>"relative", "width"=>"0.9", "crop"=>"scale"),
  array("opacity"=>70),
  array("flags"=>"layer_apply", "gravity"=>"south", "y"=>20)
  )))
PHP v2:
Copy to clipboard
(new ImageTag('sample_document.docx.jpg'))
  ->border(Border::solid(2, Color::rgb('999'))
    ->roundCorners(RoundCorners::byRadius(50)))
  ->resize(Resize::scale()->width(300))
  ->effect(Effect::sepia())
  ->extract(Extract::getPage()->byNumber(4))
  ->overlay(
      Overlay::source(Source::image('aspose_cloud_logo')
        ->transformation((new ImageTransformation())
          ->resize(Resize::scale()->width(0.9)->relative())
          ->adjust(Adjust::opacity(70))))
      ->position((new Position())
        ->gravity(Gravity::compass(Compass::south()))
        ->offsetY(20)
  ));
Python:
Copy to clipboard
CloudinaryImage("sample_document.docx.jpg").image(transformation=[
  {'border': "2px_solid_rgb:999", 'radius': 50},
  {'width': 300, 'crop': "scale"},
  {'effect': "sepia"},
  {'page': 4},
  {'overlay': "aspose_cloud_logo"},
  {'flags': "relative", 'width': "0.9", 'crop': "scale"},
  {'opacity': 70},
  {'flags': "layer_apply", 'gravity': "south", 'y': 20}
  ])
Node.js:
Copy to clipboard
cloudinary.image("sample_document.docx.jpg", {transformation: [
  {border: "2px_solid_rgb:999", radius: 50},
  {width: 300, crop: "scale"},
  {effect: "sepia"},
  {page: 4},
  {overlay: "aspose_cloud_logo"},
  {flags: "relative", width: "0.9", crop: "scale"},
  {opacity: 70},
  {flags: "layer_apply", gravity: "south", y: 20}
  ]})
Java:
Copy to clipboard
cloudinary.url().transformation(new Transformation()
  .border("2px_solid_rgb:999").radius(50).chain()
  .width(300).crop("scale").chain()
  .effect("sepia").chain()
  .page(4).chain()
  .overlay(new Layer().publicId("aspose_cloud_logo")).chain()
  .flags("relative").width(0.9).crop("scale").chain()
  .opacity(70).chain()
  .flags("layer_apply").gravity("south").y(20)).imageTag("sample_document.docx.jpg");
JS:
Copy to clipboard
cloudinary.imageTag('sample_document.docx.jpg', {transformation: [
  {border: "2px_solid_rgb:999", radius: 50},
  {width: 300, crop: "scale"},
  {effect: "sepia"},
  {page: 4},
  {overlay: new cloudinary.Layer().publicId("aspose_cloud_logo")},
  {flags: "relative", width: "0.9", crop: "scale"},
  {opacity: 70},
  {flags: "layer_apply", gravity: "south", y: 20}
  ]}).toHtml();
jQuery:
Copy to clipboard
$.cloudinary.image("sample_document.docx.jpg", {transformation: [
  {border: "2px_solid_rgb:999", radius: 50},
  {width: 300, crop: "scale"},
  {effect: "sepia"},
  {page: 4},
  {overlay: new cloudinary.Layer().publicId("aspose_cloud_logo")},
  {flags: "relative", width: "0.9", crop: "scale"},
  {opacity: 70},
  {flags: "layer_apply", gravity: "south", y: 20}
  ]})
React:
Copy to clipboard
<Image publicId="sample_document.docx.jpg" >
  <Transformation border="2px_solid_rgb:999" radius="50" />
  <Transformation width="300" crop="scale" />
  <Transformation effect="sepia" />
  <Transformation page="4" />
  <Transformation overlay="aspose_cloud_logo" />
  <Transformation flags="relative" width="0.9" crop="scale" />
  <Transformation opacity="70" />
  <Transformation flags="layer_apply" gravity="south" y="20" />
</Image>
Vue.js:
Copy to clipboard
<cld-image publicId="sample_document.docx.jpg" >
  <cld-transformation border="2px_solid_rgb:999" radius="50" />
  <cld-transformation width="300" crop="scale" />
  <cld-transformation effect="sepia" />
  <cld-transformation page="4" />
  <cld-transformation :overlay="aspose_cloud_logo" />
  <cld-transformation flags="relative" width="0.9" crop="scale" />
  <cld-transformation opacity="70" />
  <cld-transformation flags="layer_apply" gravity="south" y="20" />
</cld-image>
Angular:
Copy to clipboard
<cl-image public-id="sample_document.docx.jpg" >
  <cl-transformation border="2px_solid_rgb:999" radius="50">
  </cl-transformation>
  <cl-transformation width="300" crop="scale">
  </cl-transformation>
  <cl-transformation effect="sepia">
  </cl-transformation>
  <cl-transformation page="4">
  </cl-transformation>
  <cl-transformation overlay="aspose_cloud_logo">
  </cl-transformation>
  <cl-transformation flags="relative" width="0.9" crop="scale">
  </cl-transformation>
  <cl-transformation opacity="70">
  </cl-transformation>
  <cl-transformation flags="layer_apply" gravity="south" y="20">
  </cl-transformation>
</cl-image>
.NET:
Copy to clipboard
cloudinary.Api.UrlImgUp.Transform(new Transformation()
  .Border("2px_solid_rgb:999").Radius(50).Chain()
  .Width(300).Crop("scale").Chain()
  .Effect("sepia").Chain()
  .Page(4).Chain()
  .Overlay(new Layer().PublicId("aspose_cloud_logo")).Chain()
  .Flags("relative").Width(0.9).Crop("scale").Chain()
  .Opacity(70).Chain()
  .Flags("layer_apply").Gravity("south").Y(20)).BuildImageTag("sample_document.docx.jpg")
iOS:
Copy to clipboard
imageView.cldSetImage(cloudinary.createUrl().setTransformation(CLDTransformation()
  .setBorder("2px_solid_rgb:999").setRadius(50).chain()
  .setWidth(300).setCrop("scale").chain()
  .setEffect("sepia").chain()
  .setPage(4).chain()
  .setOverlay("aspose_cloud_logo").chain()
  .setFlags("relative").setWidth(0.9).setCrop("scale").chain()
  .setOpacity(70).chain()
  .setFlags("layer_apply").setGravity("south").setY(20)).generate("sample_document.docx.jpg")!, cloudinary: cloudinary)
Android:
Copy to clipboard
MediaManager.get().url().transformation(new Transformation()
  .border("2px_solid_rgb:999").radius(50).chain()
  .width(300).crop("scale").chain()
  .effect("sepia").chain()
  .page(4).chain()
  .overlay(new Layer().publicId("aspose_cloud_logo")).chain()
  .flags("relative").width(0.9).crop("scale").chain()
  .opacity(70).chain()
  .flags("layer_apply").gravity("south").y(20)).generate("sample_document.docx.jpg");
Kotlin:
Copy to clipboard
cloudinary.image {
publicId("sample_document.docx.jpg")
border(Border.solid(2, Color.rgb("#999")) {
roundCorners(RoundCorners.byRadius(50))
})
resize(Resize.scale() {
width(300)
})
effect(Effect.sepia())
extract(Extract.getPage() {
byNumber(4)
})
overlay(Overlay.source(Source.image("aspose_cloud_logo") {
transformation(ImageTransformation {
resize(Resize.scale() {
width(0.9f)
relative()
})
adjust(Adjust.opacity(70))
})
}) {
position(Position {
gravity(Gravity.compass(Compass.south()))
offsetY(20)
})
})}.generate()
PNG of spreadsheet

To learn more about all available image transformation options, see Image transformations and the Transformation URL API Reference.

✔️ Feedback sent!

Rate this page: