Using cURL commands to Process Header and Footer of MS Word document on macOS

cURL commands are an excellent way of transferring data with URLs. cURL commands are recommended to use APIs from command line terminals. It not just only allows us to make regular requests, but we can also post forms data, authenticate users, save responses to files and other related file manipulation operations. In simple words, curl is a command-line utility for transferring data from or to a server designed to work without user interaction. With curl, you can download or upload data using one of the supported protocols including HTTP, HTTPS, SCP, SFTP, and FTP.

Nevertheless, it also facilitates us to test RESTfull APIs.

cURL commands used

GET

The simplest and most common request/operation made using HTTP is to GET a URL. When using this command, we send a request and retrieve resources from a specific URL (a document in our case).

POST

The default request is a GET but if we have a requirement of using the same cURL command for submitting forms data, we need to use POST request. Therefore in this article, we will use the same POST command to submit text content. Please note that in order to post data, we use -d (or — data) parameter with the cURL command.

PUT

We may stumble upon a requirement to update existing data, so for that purpose, a PUT method is used. In order to accomplish this requirement, we need to use -X PUT in cURL command where X needs to be in upper case.

For further information, please visit cURL tutorial.

Note: when using cURL commands, ensure you do not put an extra space after the backslash \ else, the command will not be executed and errors will be displayed.

Setting up cURL on Mac

In this article, we are going to use cURL commands on macOS to insert and update Header Footer objects inside MS Word document using a terminal application. So in order to get started, the first thing is to install cURL on macOS. Open the Terminal application under Others category from the launchpad or, Press Command+Space and type Terminal and press enter/return key. The easiest way to install cURL is using Homebrew and for that reason, first, you need to set up homebrew on your mac machine. Type following command on command line terminal and press Enter key.

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null

Now get the brew package for cURL using the following command.

 brew install curl 

Done! You can now use curl.

Authorize Aspose.Cloud account

In order to get started with Aspose.Cloud APIs, the first step is to authenticate your account and get JWT in response. If you do not have an account, you may create one on Aspose.Cloud dashboard or signup through your existing Google or GitHub account and start using our Cloud APIs.

// First get JSON Web Token for authentication
// Get App Key and App SID from https://dashboard.aspose.cloud/
curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=[APP_SID]&client_secret=[APP_KEY]" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

Aspose.Words Cloud

Aspose offers APIs to manipulate MS Word documents and you get an option to either use Cloud APIs, On-Premise APIs or, Cross-platform Apps to process Word documents. In this blog, we have emphasized over Cloud APIs which provide us the capabilities to create, manipulate and transform MS Word documents in the Cloud. No specific software download or installation required to work with MS Word files.

The Aspose.Cloud Product family provides a set of cloud SDKs targetting popular programming languages including .NET, Java, PHP, Python, Node.js, Android, C++, Ruby, Swift and Go. All these SDKs are a wrapper around Aspose.Words Cloud REST API and cURL commands are one of the simplest and easiest ways to access REST APIs over command prompt/terminal.

In this blog, we are emphasizing on using cURL commands to manipulate the Header and Footer section inside MS Word files while accessing Aspose.Words Cloud API.

Upload Word document

Once the authentication has been performed, the next step is to upload the file to cloud storage. By using the following cURL command, the file is uploaded to default storage under InputFolder.

curl -v -X PUT "https://api.aspose.cloud/v4.0/words/storage/file/InputFolder" \
-H "accept: application/json" \
-H "authorization: Bearer <jwt token>" \
-F document=@BusinessLetter2.docx
Console output when file is uploaded to Cloud Storage
Success message when a file is uploaded to cloud storage.

Now in order to confirm the file presence on cloud storage, open My Files tab over dashboard.aspose.cloud, we can notice that a new folder named InputFolder containing BusinessLetter2.docx is appearing in the list.

Newly Created folder and file uploaded on Cloud Storage

Insert Header object

After uploading the document, we can either insert a new Header or Footer object or access an existing object and update its properties. Currently, Aspose.Words Cloud API supports the following types of Header and Footer objects.

The following command shows how to insert HeaderFirst object inside Word document already available in Cloud storage under InputFolder.

curl -v -X PUT "https://api.aspose.cloud/v4.0/words/BusinessLetter2.docx/headersfooters?folder=InputFolder" \
-H "accept: multipart/form-data" \
-H "authorization: Bearer <jwt token>" \
-d "'HeaderFirst'" \
-H "Content-Type: application/json"

Once the above command is executed, the console lists the sections inside Word document.

The header and Footer sections usually contain text, images, etc and in the following command, we are going to insert a sample text inside the first paragraph inside the header object created above.

curl -v -X POST "https://api.aspose.cloud/v4.0/words/BusinessLetter2.docx/sections/0/headersFooters/1/paragraphs?folder=InputFolder" \
-H "accept: multipart/form-data" \
-H "authorization: Bearer <jwt token>" \
-d "{ 'Text': 'Aspose.Words Cloud .NET SDK' }" \
-H "Content-Type: application/json"
Console output after Text is inserted in the Header object. Observe the path of the text inserted.

Update Text Formatting of the Header object

Once the text is inserted, we can update the text font properties. Since a word document may contain many text instances, so in order to update the text, we need to provide the exact path. So if we need to update the font properties for the above-inserted text which is inserted over sections/0/headersfooters/1/paragraphs/0/runs/0, then we need to use the following command.

Please note that now that we are going to update the font properties of an already placed objects, so we need to use the PUT command.

curl -v -X PUT "https://api.aspose.cloud/v4.0/words/BusinessLetter2.docx/sections/0/headersFooters/1/paragraphs/0/runs/0/font?folder=InputFolder" \
-H "accept: multipart/form-data" \
-H "authorization: Bearer <jwt token>" \
-d "{ 'Bold':true, 'Size': 21.0, 'Name': 'Calibri',  'Color': { 'Web': '#f54269', 'Alpha': 0 } }" \
-H "Content-Type: application/json"

Insert PageNumber in Footer

One of the important usages of Header and Footer objects is to display page number information and while using Aspose.Words Cloud, we can easily accomplish this requirement. The API also provides the capabilities to specify the location where PageNumber stamp needs to be displayed. As shown in command below, we have specified to add PageNumber information to be rendered on the Top-Right location of the page and also display it over the first page of the document.

curl -v -X PUT "https://api.aspose.cloud/v4.0/words/BusinessLetter2.docx/PageNumbers?folder=InputFolder" \
-H "accept: multipart/form-data" \
-H "authorization: Bearer <jwt token>" \
-d "{ 'Format': '{PAGE} of {NUMPAGES}', 'Alignment': 'right', 'IsTop': false, 'SetPageNumberOnFirstPage': true }" \
-H "Content-Type: application/json"

Similar to font properties update to Header instance, we can also update the font properties of Footer object which contains PageNumber information. As the page number information is comprised of three-run objects (runs/0, runs/2, and runs/3), so we need to update the font update command three times for each run instance.

curl -v -X PUT "https://api.aspose.cloud/v4.0/words/BusinessLetter2.docx/sections/0/headersFooters/3/paragraphs/1/runs/3/font?folder=InputFolder" \
-H "accept: multipart/form-data" \
-H "authorization: Bearer <jwt token>" \
-d "{ 'Bold':true, 'Size': 21.0, 'Name': 'Arial', 'Shadow': true, 'Color': { 'Web': '#f5b642', 'Alpha': 0 } }" \
-H "Content-Type: application/json"

Once all the above commands are executed, the resultant document will look similar to the preview above.

For your reference, the sample documents are also attached

Posted in Aspose.Words Cloud Product Family, Nayyer Shahbaz | Tagged , , , , , , , | Leave a comment

Add or Update header and footer in a Word Document using REST APIs

A quick view of MS Word document transformation.

A header is the top margin of each page, and a footer is the bottom margin of each page. Headers and footers are useful for including information that you want to display on every page of a document such as your name, dates, the title of the document, page numbers or disclaimers to documents. When using MS Word, it provides the capabilities to add Header and Footers based on predefined layouts or enable you to add custom headers and footers. Most built-in headers contain some placeholder text and either, you can keep the placeholder text or replace it with your own data feed. When updating the information in the Header or Footer section, the content inside the main body of the document is grayed out which indicates that these objects are totally isolated from the rest of the page content and the operation which you perform on these objects is specific to these areas.

Aspose.Words Cloud API provides the capabilities to load MS Word files from Cloud storage, as well as it allows the user to pass the input file directly in the request body and the API returns the updated file in the response object. It provides the features to Read, Add, Update or Delete specific or all Header and Footer objects. Furthermore, you may also specify to render different headers/footers for the first page and for odd/even pages. The API also enables you to set formatting information such as font and paragraph properties for the header/footer text. You also get the leverage to insert dynamic page numbers into the header/footer section. Last but not the least, you may consider using table objects to make one part of the header/footer text-align to the left edge and the other to the right edge.

Scope of Article

Our Aspose.Words Cloud SDK for .NET allows you to work with Aspose.Words Cloud REST APIs quickly and easily, as it takes care of a lot of low-level details regarding making requests and handling responses and lets you focus on writing code specific to your business requirements. In this article, we are going to use Aspose.Words Cloud SDK for .NET in Visual Studio for Mac. This post defines the steps to insert one Header object where custom formatting will be defined. Then the formatting of exiting Footer content is updated and PageNumber information is inserted at Bottom-Right position. All these operations will be performed in the cloud.

In order to get started, first, you need to install Visual Studio on your system. Create a sample solution and add NuGet reference of Aspose.Words Cloud SDK for .NET. So in order to add a reference, right-click on the solution and select Manage NuGet Packages… menu option. Enter Aspose.Words-Cloud in the search text field. Select the option and click the Add package button.

Once the NuGet package is added, Aspose.Words.Cloud.Sdk reference appears in the solution. There are some benefits of using cloud APIs in contrast to on-premise (aspose.com) APIs. The reason being, you do not need to manually keep track and update the API versions and you do not need to pay for the whole license. Simply create an account on Aspose.Cloud dashboard or signup through your existing Google or GitHub account and start using our Cloud APIs. Another amazing feature of Cloud APIs is that you can use them on any platform using any supported language.

As indicated above, the article emphasizes on options regarding the addition and update of Header and Footer objects inside MS Word document. For the sake of testing, we have used an existing MS Word document template with the name Business Letter. The document needs to be uploaded to Aspose cloud storage and all the manipulation and document processing will be performed over the cloud. Once all processing is completed, we can also download the resultant file copy from the Cloud storage.

using Aspose.Words.Cloud.Sdk;
using Aspose.Words.Cloud.Sdk.Model;
using Aspose.Words.Cloud.Sdk.Model.Requests;

In order to use Aspose.Cloud APIs, you need to use App Key and App SID information in your code. These keys are comprised of Alphanumeric digits. These are unique codes associated with your subscription account. In order to get these details, please click My Apps tab on Aspose.Cloud dashboard. Once we have the Keys, we need to initialize Aspose.Words API object.

string MyAppKey = "f6axxxxxxxxxxxxxxxxxx";     // Get AppKey and AppSID from https://dashboard.aspose.cloud/
string MyAppSid = "478e4827-xxxxx-xxxx-xxxx-xxxxxxx"; // Get AppKey and AppSID from https://dashboard.aspose.cloud/
// create an object of WordsApi while passing AppKey and AppSid information
WordsApi wordsApi = new WordsApi(MyAppKey, MyAppSid);

Insert Header object

In order to add the header object inside the MS Word file, we need to perform the following operations in sequence.

  1. Create an object of InsertHeaderFooterRequest where we pass HeaderFooterLink type as an argument.
  2. Insert HeaderFooterRequest object to WordsApi object using InsertHeaderFooter (…) method.
  3. Create a Run object which holds sample Text information.
  4. Create InsertRunRequest object where we pass the reference of paragraph(SectionPath) in HeaderFooter object, where Run text needs to be added.
    Then call InsertRun (…) method of WordsApi, which adds the RunRequest to HeaderFooter object.

The HeaderFooter.TypeEnum can be either of the following values.

Image showing preview of recently added Header

Update Text formatting of Newly inserted Header

Once the Header object is added, we can update the text formatting of the content inside it. In order to fulfill this requirement, we need to perform the following steps.

  1. Create an object of Font class, where we specify Font name, size, color information.
  2. In order to make the text more presentable, mark Engrave property as True.
  3. Create an object of UpdateRunFontRequest class where we pass the input file, Font, SectionPath and runIndex as an argument.
  4. Finally, use UpdateRunFont(..) method and add UpdateRunFontRequest object to WordsApi instance.
Image showing preview of Header after text formatting has been applied.

Update formatting of existing Footer object

The API also offers the feature to update the formatting of content inside the existing Header / Footer object. In order to fulfill this requirement, we can use the above-specified code lines but the only difference is the change of headerfooter index to 2. See the following code line.

// Apply formatting to first paragraph of HeaderFooter object
var FooterDocumentParagraphRunFontRequest = new Aspose.Words.Cloud.Sdk.Model.Requests.UpdateRunFontRequest("BusinessLetter.docx", 
FooterFontDto, "sections/0/headersfooters/2/paragraphs/0", FooterrunIndex);
Image displaying the change in Footer text formatting.

Add PageNumber information in Footer Section

Page numbers provide very useful information such as the current page and the total number of pages in a document. The following steps define how to accomplish the requirements.

  1. First create an object of PageNumber class, where we define, Alignment of text, the format of the text, location to render PageNumber information and also, specify if PageNumber needs to be rendered on the first page or not.
  2. Create InsertPageNumbersRequest object and pass PageNumber object as an argument.
  3. Finally, call InsertPageNumbers(..) method to add InsertPageNumbersRequest to WordsApi instance.
Image displaying a preview of MS Word file with Page number in Footer section.

Apart from Aspose.Words Cloud SDK for .NET, we also have Cloud SDKs available for Java, PHP, Ruby, Python, Go, Swift, C++, Node.Js, Android. For further details, please visit Aspose.Words Cloud.

Posted in Aspose.Words Cloud Product Family, Nayyer Shahbaz | Tagged , , , | Leave a comment

Convert an Image to Grayscale with RESTful API

Image to Grayscale

Images are widely used to represent information. Considering the demand and requests, we have introduced a most awaited feature of image to grayscale conversion in Aspose.Imaging Cloud API February 2020 release.

You can convert, edit or manipulate BMP, GIF, JPEG, PSD, TIFF, WEBP, PNG, and other supported file formats‘ images. Organizations with huge databases of pictures prefer to keep grayscale images for size considerations. For instance, some law enforcement agencies would consider facial features and geometry as important or efficient as compared to color. Let us take a look at available APIs for true color image to grayscale conversion with Aspose.Imaging Cloud API.

APIDescription
GET /imaging/{name}/grayscale Grayscale an existing image
POST /imaging/grayscaleGrayscales an image. Image data is passed as zero-indexed multipart/form-data content or as raw body stream

Following is a C# code snippet to convert a sample image to grayscale:

This code snippet uploads the input file from local storage to Cloud storage and then converts the RGB image to grayscale image. The API saves output grayscale image in Cloud storage that looks like below screenshot:

Input Image

Output Image

Greyscale image

Let us check out another scenario where the source file is passed in request and the response contains converted grayscale image which is saved in local storage. This approach does not need uploading or downloading the image from Cloud storage. Below is the C# code snippet based on this workflow:

Wondering about working with the same feature in other programming languages? No worries, Aspose.Imaging Cloud SDKs are available for all popular languages so you can conveniently call the API from your favorite platforms. Moreover, we have also ported images to grayscale conversion examples to the supported languages including Python, Java, PHP, Node.js, and Ruby.

Aspose.Imaging Cloud API can take your applications a step forward to the next level. Many other fixes and maintenances are also part of this release; including some exception fixes and improvements for multi-page images export. You may take an overview at Release Notes for more details. You can Sign Up for free and start learning the API today. We maintain API documentation for basic scenarios. You can also reach out to us at Free Support Forum if you need any further help.

Related Post:

Reverse Image Search and Image Deskewing with Aspose.Imaging Cloud

Posted in Aspose.Imaging Cloud Product Family | Tagged , , , , , , | Leave a comment

Replace Text in PDF and Encrypt PDF with Password Protection

Replace text in PDF file

Aspose.PDF Cloud API lets you create Cloud-based applications in your favorite programming language. You can create PDF documents from scratch, edit existing PDF files or convert supported file formats with the API. You can replace text in a PDF document as well as encrypt it with Password protection. Many other robust features are offered by the API that you can integrate into your applications.

Find and replace text is one of the commonly used features of almost all word processing applications. You might want to update some text in hundreds or thousands of PDF documents. With Aspose.PDF Cloud API, you can automate this task and achieve your requirements in little time by few lines of code. You can use any of the following APIs as per your requirements:

Sr. No. APIDescription
1 POST /pdf/{name}/text/replace Replace Text Items from a PDF Document
2 POST /pdf/{name}/pages /{pageNumber}/text/replaceReplace all Text Items from a Page in a PDF Document

Let us discuss both use cases one by one. The scope of first one extends to the whole PDF document. It finds and replaces all occurrences of specific text and updates it with new text. Below .NET code snippet finds and replaces market with m_a_r_k_e_t in all pages of the document.

TextReplaceListRequest is a multiple text replacements request where Request Object Structure includes “TextReplaces” as a list of text replacement settings, “DefaultFont” as name of font to use if requested font is not embedded, “StartIndex” as index of the first match to be replaced, and “CountReplace” as the number of matches to be replaced.

Find and replace text

This screenshot elaborates on the efficiency of API where several instances of text are replaced in all sections of the page.

Find and Replace text on the page level

You can also update the text on a specific page with Aspose.PDF Cloud API. The text replacement can further be narrowed down to a specific area of a page with rectangular coordinates. However, please bear in mind that bottom left is the (0,0) coordinate and the standard unit in Aspose.PDF Cloud API is “Point” where 72 points equal 1 inch. The following code snippet is written using Aspose.PDF Cloud SDK for .NET, which is a wrapper around REST API allowing you to process documents quickly and easily in .NET, gaining all benefits of strong types and IDE highlights

Text replacement in a specific area of the page is further clarified by this screenshot as compared to the image we have considered in the previous example.

Encrypt and Password Protect a PDF Document

PDF documents can often contain confidential information so you might need to secure it from unauthorized access. Aspose.PDF Cloud API offers the most advanced Crypto Algorithms including RC4x40, RC4x128, AESx128, and AESx256. In addition to encryption, the API supports setting up an owner or permission password as well as a user password. Below is the .NET code snippet utilizing same feature:

Aspose.PDF Cloud API offers many other advanced features that can make your applications truly feature-rich. You can Sign Up for Free Trial and explore API references as well as API documentation for further information. In case of any assistance, please feel free to contact us via Free Support Forum.

Related Post:

Convert HTML to PDF with Aspose.PDF Cloud API

Posted in Aspose.PDF Cloud Product Family | Tagged , , , , , , , , | Leave a comment

Create a Chart in Excel file and Export Chart to Image with Cloud API

Create charts in excel files

Aspose.Cells REST APIs enrich your Cloud-based applications with spreadsheet processing features. The API comes with several SDKs that are distributed under an MIT license, so you can simply integrate the features in your applications. This utility lets you focus on what matters the most, while minor details being managed by the SDK itself.

In the context of spreadsheet processing, charts are a very useful way to summarize information and present it in visual form. Therefore, let us explore the chart creation as well as chart rendering support in Aspose.Cells Cloud. Supported Chart types include Area, Bar, Bubble, Column, Cone, Pie, Line and many others. Let us add a Pie chart using Aspose.Cells for .NET SDK.

You need to specify several parameters in this code snippet to add the chart in a specific Worksheet of a Workbook, and other information including Chart Area, Chart Title, Category Data, and others. This code snippet adds a Pie chart in your template file, as shown in the screenshot below:

Chart in Excel

You can notice the values in the first column and the Pie chart added to the desired worksheet in your Cloud Storage. Chart title and other information are the same as the code snippet we have discussed above. Likewise, you can create other charts that can be different or complicated than this demonstration.

Chart to Image Rendering in Aspose.Cells for .NET SDK

A chart to image rendering is another useful feature of Aspose.Cells Cloud. Let us continue the example from the same workbook where we have added the chart in the above example. You can use the below .NET code snippet to convert a chart to an image. However, please keep in mind that the charts are zero-based index so the first chart in the worksheet is referred with zero. Following example elaborates on the feature and clarifies this point as well:

You can render a chart to PNG, JPEG, BMP, TIFF, and other image formats. However, the response of this API call will include an instance of System.IO.Stream class that will contain the image of the Chart. Since the images are visual objects, let us convert this stream to a File. Below is one of the possible approaches you can use for this purpose:

The high quality rendered image of the chart will look like the screenshot below:

Chart to image

Likewise, the API includes many other out of the box features for spreadsheets creation, manipulation, and conversion. You can further explore API references to learn more about Charts support and other features in Aspose.Cells Cloud. We host many SDKs at GitHub that include several examples for hands-on experience with the API. You can also refer to API documentation where we maintain the most basic and frequent use cases. In case of any concerns, please feel free to contact us for any help via Free Support Forum.

Related Post

Create, Edit or Convert Excel Files with Aspose.Cells Cloud API

Posted in Aspose.Cells Cloud Product Family | Tagged , , , , , , , | Leave a comment

Convert Word to HTML and Vice Versa using REST APIs

Aspose.Words Cloud API

Aspose.Words Cloud enables you to convert Word documents, including DOC and DOCX, to HTML file format. Word to HTML conversion is helpful in situations where you want to show contents of a Word document online and make them search engine friendly. The additive advantage is that no special viewer or 3rd party application is needed for viewing HTML files. Aspose.Words Cloud provides the following APIs to convert a Word Document to HTML:

Sr. No.APIDescription
1GET /words /{name}Exports the document into the specified format.
2PUT ​/words​/convertConverts document from the request’s content to the specified format.
3PUT ​/words​/{name}​/saveAsConverts document to destination format with detailed settings and save the result to storage.

Word to HTML Conversion

Before you call the above APIs, you need to register an account with Aspose Cloud and get your App Key and SID at Cloud Dashboard. As soon as you sign up, a generous Free Trial will be awarded to you so that you can test APIs without any evaluation limitations.

The following cURL example shows how to convert DOCX to HTML:

This code snippet efficiently converts DOCX to HTML files. It will not create any additional images or style sheets. For instance, it converts the image in the DOCX file to the base64 image so that you can get the highest-fidelity output. Following are the screenshots of files:

Input DOCX file

DOCX to HTML

Output HTML file (Google Chrome preview)

Word to HTML

You can notice the quality of HTML rendering in the above screenshots.

Word to HTML Conversion with Detailed Settings

PUT /words/{name}/saveAs API lets you convert Microsoft Word document to HTML with details settings. The following cURL example generates a ZIP file as output because we have set ‘ZipOutput’ to ‘true’ in HtmlSaveOptions. For a complete list of HtmlSaveOptions, please check the documentation.

The generated ZIP file will include the HTML file and the images as PNG, JPG, etc. instead of converting them to base64 images. Let’s take a look at a comparison screenshot showing the source of HTML files generated by these code snippets.

The marked sections on this image clarify how both approaches work. The left side displays the image tag containing data as base64 image. While the right side, captured from DOCXtoHTML.zip, displays the image as a local PNG file.

HTML to Word Conversion

We have addressed the Word to HTML conversion in detail. Let us check out HTML to Word conversion, which is another worth-mentioning feature of Aspose.Words Cloud. It lets you convert a web-page to DOCX simply by specifying the URL. The cURL example is pretty simple, as under:

The rendering engine is efficient enough to produce WYSIWYG output in the DOCX file. Following is the screengrab of the output DOCX file.

The heading levels, lists, indentation, formatting, everything is in place that speaks volumes about the capabilities of the rendering engine. We hope you would love to use these simple yet powerful features. In case of any queries or concerns, please reach out to us via the Free Support Forum. We will be glad to assist you!

Suggested Articles

Perform Mail Merge in a Word Document

Convert Word to PDF

Posted in Aspose.Words Cloud Product Family | Tagged , , , , , , | Leave a comment

Reverse Image Search and Image Deskewing with Aspose.Imaging Cloud

Reverse image search API

We are excited to inform you about the newly introduced features in Aspose.Imaging Cloud API. Now it supports website-based image source for reverse image search. The image deskewing feature also makes the API second to none. We are continuously working and improving to offer you the best solutions possible.

Reverse image search is useful for finding duplicate or similar images. It can also help to monitor obscene or graphic content. You can also counter copyrights violations or trademark counterfeit by searching digitally signed images with the reverse search. Moreover, image deskewing is another feature that adds value to Aspose.Imaging Cloud API. It is also relevant to scanned PDF documents where skewed images often exist. Such PDF documents are frequently converted to searchable PDF documents where the results can be improved by deskewing the images. Let us dissect these features below.

Reverse Image Search using Aspose.Imaging Cloud SDK for Python

Several SDKs are available to communicate with Aspose.Imaging Cloud API. The SDKs take care of all minor details so that you can proceed with your requirements hassle-free. The SDKs include .NET, Java, Python, PHP, Ruby, Android, and Node.js. Here we will be working with a Python example:

First of all, you would need a free sign up at Aspose.Cloud. Install Python 2.7 or later and then add the following PyPi package to your requirements.txt.

aspose-imaging-cloud>=20.1

Now import the dependencies as under:

import aspose-imaging-cloud

Now, you can use below Python code to call the APIs and test the feature:

The website-based image source for reverse image search is well elaborated in this example. It includes an additional step of resizing the image to demonstrate the efficiency of API. Image dimensions may differ but the API will produce reliable and accurate results. Following is the screenshot of the output:

As you can notice that the number of similar images, the URL and similarity percentage are shown by the parameters in API response.

Image Deskewing using Aspose.Imaging Cloud SDK for .NET

Images contain a lot of information and image processing has assumed a lot of importance these days. A very common use case is skewed images in scanned PDF documents or often in the images from mobile phone cameras. Aspose.Imaging Cloud API now includes the feature of deskewing the images. You can deskew the images in BMP, GIF, JPEG, JPEG2000, PSD, TIFF, WEBP, and PNG format. Let’s consider a .NET example for deskewing a TIFF image.

This example uploads a sample image to Cloud Storage, deskews it and uploads the updated image to Cloud Storage. Below are the screenshots of input and output TIFF images.

Input TIFF Image

Output TIFF Image (Deskewed)

Aspose.Imaging Cloud SDK for Ruby

Another important addition in SDKs lineup is that we have published Aspose.Imaging Cloud SDK for Ruby. It lets you integrate robust image processing features in your Ruby applications.

We encourage you to try these efficient features of the API and share your experiences with us. Let us know if you have any suggestions or queries. We look forward to hearing back from you via Free Support Forums.

Related Article:

Introducing Aspose.Imaging Cloud V3

Posted in Aspose.Imaging Cloud Product Family | Tagged , , , , | Leave a comment

Convert HTML to PDF with Aspose.PDF Cloud API

HTML to PDF

We often need to convert HTML files to PDF owing to several strengths of PDF file format. Considering the features of PDF files, Aspose.PDF Cloud API has been structured and designed to cater to all of your PDF related needs. You can create, edit or manipulate supported file formats. Among other file format conversions, HTML to PDF conversion is one of the famous use cases.

Aspose.PDF Cloud is a REST API so you would not need any complicated environment configurations or setups. Several SDKs are also available so that you can easily achieve the requirements. You can work with any of the SDK including .NET, Java, PHP, Android, Python, Ruby, Node.js, Swift or Go. Get started today by signing up with existing GitHub, Twitter, Facebook or Google account. A generous free trial is granted when you sign up.

Convert HTML to PDF file

You can convert HTML to PDF by following below steps:

  1. Upload the HTML file and related CSS, JS, Images as a single ZIP file to Cloud Storage
  2. Get JSON Web Token for authentication
  3. Call the API https://api.aspose.cloud/v3.0/pdf/create/html
  4. Save generated PDF file received as API response

Following cURL code follows these steps and converts the HTML file:

You can also notice several optional parameters specified with the API call in above code. These include page dimensions and page margins of the generated PDF document which can be specified beforehand. Please note that the standard unit in Aspose APIs is point, where 72 points equal 1 inch. Therefore, according to passed values, the margin is set to half-inch and the page dimensions equal to A4 size.

Input HTML file

Output PDF file

High fidelity PDF rendering with Aspose.PDF Cloud API via single API call is noteworthy in the screenshot. Likewise, this simple yet powerful feature is capable of rendering even complicated documents in WYSIWYG format.

Moreover, Aspose Cloud APIs support 3rd party cloud storages including Google Drive, Dropbox etc. The following cURL example is using Amazon S3 Storage for conversion:

This code will upload source file to AWS S3 Storage and will save generated PDF file on local storage. It also sets the page size of PDF document as of A4 standard, which can be verified from the document’s properties tab as in the screenshot below:

Java Example

Let us now consider a Java example to convert HTML to PDF with Aspose.PDF Cloud SDK for Java. The SDK is a wrapper around REST API in Java that allows you to process documents while gaining all benefits of strong types and IDE highlights. You can install it by adding below dependency in the project’s POM file:

<dependency>
    <groupId>com.aspose</groupId>
    <artifactId>aspose-cloud-pdf</artifactId>
    <version>20.2.0</version>
    <scope>compile</scope>
</dependency>

Aspose.PDF Cloud SDK also includes a suite of unit tests. The unit tests also serve the purpose of examples that explain how to work with Aspose.PDF Cloud SDK for Java. Learn more.
Following is the Java code to convert HTML file to PDF document:

These are some simple and basic demonstrations of high fidelity rendering of PDF documents. Furthermore, the API is rich in features and comes with free trial without any watermarks or limitations. In case you have any concerns, questions or suggestions, get in touch with us via free support forums and we would love to assist you. Happy coding!

Suggested Articles:

Posted in Aspose.PDF Cloud Product Family | Tagged , , , , , , | Leave a comment

Convert FBX to PDF and GLB to PDF with high-quality rendering

FBX to PDF API

3D file formats are quite common these days. From concept inception to planning and implementation, 3D modeling is used in all phases. Aspose.3D Cloud API is a feature-rich API that lets you create, edit or convert several supported file formats. You can translate, rotate or convert the files as per your requirements. Aspose.3D Cloud API helps you to manage file formats used in 3D modeling, gaming, computer-aided design and much more, on any platform without any dependency on 3D modeling and rendering software.

Aspose.3D Cloud is a REST API solution that helps you to add features to create, modify and convert 3D objects, models and entities in your applications. We also offer SDKs which are wrappers to interact with Cloud APIs. They take care of low-level details and manage the requests and responses so that you can dedicate your efforts to the main objectives. For now, you can integrate .NET or Java SDK in your applications, whereas we will be supporting more SDKs soon.

You can save a 3D file to any supported file format such as 3DS, AMF, RVM, DAE, DRC, FBX, gLTF, OBJ, PDF, PLY, STL, U3D, DXF, JT, X, and 3MF. You can convert a 3D file to another format with default settings or can pass a detailed setting parameter for the conversion. Most popular 3D format conversions include FBX to PDF and GLB to PDF conversions. You may need to convert a 3D file to PDF for printing, archival, approval or any other purpose.

FBX to PDF Conversion

Let us convert a sample FBX to PDF format file here as a demonstration. We will follow the below steps for the conversion:

  1. Upload the source FBX file to Cloud Storage
  2. Call the API to convert the FBX file to PDF
  3. Download converted PDF file from Cloud Storage

Following is the cURL code for FBX to PDF conversion:

Input FBX file

Output PDF file

You can notice how efficiently the PDF file has been rendered by Aspose.3D Cloud API. Let us take a look at GLB to PDF conversion feature as well.

GLB to PDF Conversion

Aspose.3D Cloud API is pretty simple and easy to work with. GLB to PDF conversion also includes a simple API call that converts input GLB file and returns output PDF document as API response. Below cURL example demonstrates GLB to PDF rendering:

Likewise, you can further explore these high fidelity renderings and other features with Free Trial while consulting API references. Do share your experience, feedback or suggestions with us via Free Support Forum.

Related Post:

Manipulate 3D Models and Objects with Aspose.3D Cloud

Posted in Aspose.3D Cloud Product Family | Tagged , , , , , , | Leave a comment

Create, Edit or Convert Excel Files with Aspose.Cells Cloud API

Create edit or convert excel files

Aspose.Cells Cloud is a REST API that allows you to perform simple as well as complex operations on your Excel files including, but not limited to, XLSX, XLS, XLSB, XLSM, and several other supported file formats. You can create these files from scratch as well as from existing template file. Moreover, you can also convert supported file formats with Aspose.Cells Cloud API. You can use many other features of the API without needing to install MS Excel or any other third party application.

You only need to Sign Up for free and get your App SID and App Key as guided in Creating and Managing Account. After the sign-up, you are ready to test the API as per your requirements. You may work with default storage or configure 3rd party storage with Aspose APIs. Now you are ready to test the basic yet important feature of Aspose.Cells Cloud API. You can use cURL commands to call the REST APIs from any platform. We also offer several SDKs that take care of low-level details for making a request and handling the responses, so that you may focus over the main code. These SDKs include .NET, Java, PHP, Python, Ruby, Node.js, Android, Swift and Perl.

Create Excel files without using MS Excel Application

Let’s create a blank workbook with Aspose.Cells Cloud API. Below are the steps you need to follow for creating an XLSX file:

  1. Get your App Key and App SID after signing up
  2. Get JSON Web Token
  3. Call the API https://api.aspose.cloud/v3.0/cells/CellsCloud.xlsx
  4. Empty XLSX file will be created in your configured Storage

Output XLSX file created with Aspose.Cells Cloud API

Create XLSX file without MS Excel

Likewise, you can also create a workbook based on an existing template file. The below code elaborates on how can you utilize a template file while creating a new workbook. Please note, the example assumes that the template file, Template.xlsx in this case, is already uploaded in Cloud storage.

Once you have created a new file using any of the above approaches, you are all set to edit, manipulate and convert the XLSX, XLS or any other file format to supported file format. Here we will be adding a blank worksheet to newly created XLSX or XLS file.

Below sreenshot shows addition of empty worksheet with the name specified by you, in the curl code.

These examples elaborate on how simple is it to work with Excel files. Many other useful features are offered by Aspose.Cells Cloud API as you may visit API documentation and API references for further information. In case of any query, suggestion or feedback, please feel free to get in touch with us via Free Support Forum. We would love to hear back from you!

Related Post:

Apply Conditional Formatting to Excel Files

Posted in Aspose.Cells Cloud Product Family | Leave a comment