In the realm of modern information processing, PowerPoint presentations have become a ubiquitous means of sharing information, delivering impactful presentations, and conveying ideas. Now if you are seeking to uncover hidden trends, repurpose content, or gain deeper understanding, the ability to extract text from PowerPoint is an amazing skill. However, extracting the text from these presentations can be a challenging task, especially when dealing with large or complex files. This article unveils a powerful solution to extract text from PowerPoint, as well as explains the innovative capabilities of the Aspose.Slides Cloud SDK for .NET.
- REST API to Extract PowerPoint Text
- Extract Text From PowerPoint using C# .NET
- Extract Text From Particular Slide using cURL Commands
REST API to Extract PowerPoint Text
When it comes to extracting text from PowerPoint presentations, then Aspose.Slides Cloud SDK for .NET stands out as a powerful and versatile tool. With its rich set of features and comprehensive API, this SDK empowers developers to effortlessly extract text from presentations with precision and efficiency.
The first step is the installation of SDK. So we need to first search Aspose.Slides-Cloud
in NuGet packages manager and click the Add Package
button. In case you do not have an existing account over cloud dashboard, simply create a free account by following the instructions specified over quick start.
Extract Text From PowerPoint using C# .NET
Let’s explore the details on how we can efficiently extract the text from complete PowerPoint using C# .NET code snippet.
Now let’s develop our understanding about the above stated code snippet.
SlidesApi slidesApi = new SlidesApi(clientID, clientSecret);
Create an object of SlidesApi class where we pass the client credentials as arguments.
var textItems = slidesApi.GetPresentationTextItems(sourcePPTX, true, null);
Call the API to extract all textual content from PowerPoint presentation available in cloud storage.
StreamWriter sw = new StreamWriter("Test.txt");
Create StreamWriter which is going to help us in saving the extracted content on local drive.
foreach (var textItem in textItems.Items)
{
sw.WriteLine(textItem.Text);
}
sw.Close();
Iterate through each occurrence of extracted text and save the output in a textual file.
You may consider downloading the sample PowerPoint used in the above example from Inspirational bookmarks.pptx.
Extract Text From Particular Slide using cURL Commands
Another alternative to extract text from PowerPoint slides is by utilizing cURL commands. With cURL, you can interact with the Aspose.Slides Cloud API directly through HTTP requests, making it a flexible and accessible option for text extraction capabilities. So, by constructing the appropriate API endpoint and specifying the desired parameters, you can send a cURL command to retrieve text from specific slides or the entire presentation.
The first step in this approach is to generate a JWT access token. So, please execute the following command:
curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=bb959721-5780-4be6-be35-ff5c3a6aa4a2&client_secret=4d84d5f6584160cbd91dba1fe145db14" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"
Now, execute the following command to extract text from the second slide of a PowerPoint presentation.
curl -v "https://api.aspose.cloud/v3.0/slides/{sourceFile}/slides/2/textItems?withEmpty=false" \
-X GET \
-H "accept: application/json" \
-H "authorization: Bearer {accessToken}" \
-o "Extracted.txt"
Replace sourceFile
with the name of an input PowerPoint available in cloud storage, and accessToken
with JWT access token generated above.
Conclusion
In conclusion, we have learned that the ability to extract text from PowerPoint slides is a valuable feature that allows us to access and utilize the textual content within presentations for various purposes. Whether it’s for data analysis, content parsing, or any other application, extracting text from PowerPoint slides empowers us to unlock the information contained within these files. By leveraging the Aspose.Slides Cloud SDK for .NET, we can easily and efficiently perform text extraction operations in .NET application or, the usage of cURL commands provides platform independent and a convenient approach.
Useful Links
Related Articles
We highly recommend visiting the following blogs: