PdfToTextClient Class |
Namespace: SelectPdf.Api
The PdfToTextClient type exposes the following members.
Name | Description | |
---|---|---|
PdfToTextClient |
Construct the Pdf To Text Client.
|
Name | Description | |
---|---|---|
getNumberOfPages |
Get the number of pages processed from the PDF document.
| |
getTextFromFile |
Get the text from the specified pdf.
| |
getTextFromFileAsync |
Get the text from the specified pdf with an asynchronous call.
| |
getTextFromFileToFile |
Get the text from the specified pdf and write it to the specified text file.
| |
getTextFromFileToFileAsync |
Get the text from the specified pdf with an asynchronous call and write it to the specified text file.
| |
getTextFromFileToStream |
Get the text from the specified pdf and write it to the specified stream.
| |
getTextFromFileToStreamAsync |
Get the text from the specified pdf with an asynchronous call and write it to the specified stream.
| |
getTextFromUrl |
Get the text from the specified pdf.
| |
getTextFromUrlAsync |
Get the text from the specified pdf with an asynchronous call.
| |
getTextFromUrlToFile |
Get the text from the specified pdf and write it to the specified text file.
| |
getTextFromUrlToFileAsync |
Get the text from the specified pdf with an asynchronous call and write it to the specified text file.
| |
getTextFromUrlToStream |
Get the text from the specified pdf and write it to the specified stream.
| |
getTextFromUrlToStreamAsync |
Get the text from the specified pdf with an asynchronous call and write it to the specified stream.
| |
searchFile(String, String) |
Search for a specific text in a PDF document. The search is case insensitive and returns partial words also.
| |
searchFile(String, String, Boolean, Boolean) |
Search for a specific text in a PDF document.
| |
searchFileAsync(String, String) |
Search for a specific text in a PDF document with an asynchronous call. The search is case insensitive and returns partial words also.
| |
searchFileAsync(String, String, Boolean, Boolean) |
Search for a specific text in a PDF document with an asynchronous call.
| |
searchUrl(String, String) |
Search for a specific text in a PDF document. The search is case insensitive and returns partial words also.
| |
searchUrl(String, String, Boolean, Boolean) |
Search for a specific text in a PDF document.
| |
searchUrlAsync(String, String) |
Search for a specific text in a PDF document with an asynchronous call. The search is case insensitive and returns partial words also.
| |
searchUrlAsync(String, String, Boolean, Boolean) |
Search for a specific text in a PDF document with an asynchronous call.
| |
setCustomParameter |
Set a custom parameter. Do not use this method unless advised by SelectPdf.
| |
setEndPage |
Set End Page number. Default value is 0 (process till the last page of the document).
| |
setOutputFormat |
Set the output format. The default value is OutputFormat.Text.
| |
setStartPage |
Set Start Page number. Default value is 1 (first page of the document).
| |
setTextLayout |
Set the text layout. The default value is TextLayout.Original.
| |
setTimeout |
Set the maximum amount of time (in seconds) for this job.
| |
setUserPassword |
Set PDF user password.
|
using System; using SelectPdf.Api; namespace SelectPdf.Api.Tests { class Program { static void Main(string[] args) { string testUrl = "https://selectpdf.com/demo/files/selectpdf.pdf"; string testPdf = "Input.pdf"; string localFile = "Result.txt"; string apiKey = "Your API key here"; Console.WriteLine("This is SelectPdf-{0}.", ApiClient.CLIENT_VERSION); try { PdfToTextClient client = new PdfToTextClient(apiKey); // set parameters - see full list at https://selectpdf.com/pdf-to-text-api/ client .setStartPage(1) // start page (processing starts from here) .setEndPage(0) // end page (set 0 to process file til the end) .setOutputFormat(OutputFormat.Text) // set output format (0-Text or 1-HTML) ; Console.WriteLine("Starting pdf to text ..."); // convert local pdf to local text file client.getTextFromFileToFile(testPdf, localFile); // extract text from local pdf to memory // string text = client.getTextFromFile(testPdf); // print text // Console.WriteLine(text); // convert pdf from public url to local text file // client.getTextFromUrlToFile(testUrl, localFile); // extract text from pdf from public url to memory // string text = client.getTextFromUrl(testUrl); // print text // Console.WriteLine(text); Console.WriteLine("Finished! Number of pages processed: {0}.", client.getNumberOfPages()); // get API usage UsageClient usageClient = new UsageClient(apiKey); UsageInformation usage = usageClient.getUsage(false); Console.WriteLine("Conversions remained this month: {0}.", usage.Available); } catch (Exception ex) { Console.WriteLine("An error occurred: " + ex.Message); } } } }
using System; using SelectPdf.Api; namespace SelectPdf.Api.Tests { class Program { static void Main(string[] args) { string testUrl = "https://selectpdf.com/demo/files/selectpdf.pdf"; string testPdf = "Input.pdf"; string apiKey = "Your API key here"; Console.WriteLine("This is SelectPdf-{0}.", ApiClient.CLIENT_VERSION); try { PdfToTextClient client = new PdfToTextClient(apiKey); // set parameters - see full list at https://selectpdf.com/pdf-to-text-api/ client .setStartPage(1) // start page (processing starts from here) .setEndPage(0) // end page (set 0 to process file til the end) .setOutputFormat(OutputFormat.Text) // set output format (0-Text or 1-HTML) ; Console.WriteLine("Starting search pdf ..."); // search local pdf IList&TextPosition> results = client.searchFile(testPdf, "pdf"); // search pdf from public url // IList&TextPosition> results = client.searchUrl(testUrl, "pdf"); Console.WriteLine("Search results:\n{0}\nSearch results count: {1}.", string.Join("\n", results), results.Count); Console.WriteLine("Finished! Number of pages processed: {0}.", client.getNumberOfPages()); // get API usage UsageClient usageClient = new UsageClient(apiKey); UsageInformation usage = usageClient.getUsage(false); Console.WriteLine("Conversions remained this month: {0}.", usage.Available); } catch (Exception ex) { Console.WriteLine("An error occurred: " + ex.Message); } } } }