Created
August 11, 2024 16:35
Revisions
-
aspose-cloud-kb created this gist
Aug 11, 2024 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,41 @@ using System; using System.IO; using Aspose.Pdf.Cloud.Sdk.Api; using Aspose.Pdf.Cloud.Sdk.Model; namespace Aspose.PDF.Cloud.Examples.Kb { public class PdfTasks { public static void CountWords() { PdfApi pdfApi = new PdfApi("Client Secret", "Client ID"); String fileName = "sample.pdf"; String storage = ""; String folder = ""; try { // Upload source file to aspose cloud storage for counting words pdfApi.UploadFile(fileName, new MemoryStream(System.IO.File.ReadAllBytes(fileName))); // Invoke Aspose.PDF Cloud SDK API to get words count per page from pdf document WordCountResponse apiResponse = pdfApi.GetWordsPerPage(fileName, storage, folder); if (apiResponse != null && apiResponse.Status.Equals("OK")) { foreach (PageWordCount PageWordCount in apiResponse.WordsPerPage.List) { Console.WriteLine("Page Number :: " + PageWordCount.PageNumber + " Total Words :: " + PageWordCount.Count); } Console.ReadKey(); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); } } } }