Is there something in the pdf.kit which can be used to determine if a pdf file is "text-searchable"? I've glanced through the documentation and nothing jumped out, but it never hurts to ask the developer if I'm missing something. FYI, this is of interest to me because I have a process to OCR pdf files. However, if the pdf is already text-searchable, I don't need to process it.
Hello Dan,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
I am sorry to inform you that, the feature to determine if Pd file contains text, is not yet supported.
As a workaround, you can extract the text from pdf file and determine if it contains the text, while analyzing the results. In order to make the text extraction process faster, you can limit the Startpage and EndPage to first page of the Pdf file, and can easily find out if it contains the text or not.
That is an interesting work-around. After extracting the text, I was going to use the GetWordCount to determine if any text was found. In the API documentation, it implies that GetWordCount is obsolete. Can you refer me to the current method I should use? Also, right now I am using the evaluation version of the pdf kit, and it adds the evaluation text to the pdf before it counts the words, so even if the pdf has only an image, the word count will be > 0. I assume once I have a license that the word count would be 0, but I'd like to know for sure. The attached pdf is an image and contains no searchable text. Can you do an extracttext on it and verify that the word count is 0?
It is quite difficult to count words in string for all languages and it is out of the scope of our product. So we have made the GetWordCount method obsoleted. You have to process the string by yourself to count the words in it. If you purchase the product, the evaluation text will disappear.
Hello Dan,<?xml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” />
You can try using the following code snippet to check if the Pdf file contains text of is an Image pdf.
[C#]
// Instantiate a memoryStream object to hold the extracted text from Document
MemoryStream ms = new MemoryStream();
//Instantiate PdfExtractor object
PdfExtractor extractor = new PdfExtractor();
//Bind the input PDF document to extractor
extractor.BindPdf(@"C:\pdftest\new_test_form_updated.pdf");
// Specify the Start page of the Pdf document
extractor.StartPage = 1;
// Specify the end page of the Pdf document. Limit the extraction to single page, rather than searching whole document
extractor.EndPage= 1;
//Extract text from the input PDF document
extractor.ExtractText();
//Save the extracted text to a text file
extractor.GetText(ms);
// Check if the MemoryStream length is greater than or equal to 1
if (ms.Length <= 1)
MessageBox.Show("Pdf is an Image Pdf");
else
MessageBox.Show("Pdf contains text");
Regarding Watermark issue, for the time being you can request the Temporary license and can test our product. Please visit the following link for information on How to get a Temporary License.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.