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.
For information on how to extract text please visit, http://www.aspose.com/documentation/file-format-components/aspose.pdf.kit-for-.net-and-java/extract-text-from-pdf-document.html
Also please visit PdfExtractor Members.
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.
// 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
// 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
//Extract text from the input PDF document
//Save the extracted text to a text file
// Check if the MemoryStream length is greater than or equal to 1
if (ms.Length <= 1)
MessageBox.Show("Pdf is an Image Pdf");
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.
In case of any further query, feel free to share.
thanks for the tip regarding the temp license, which I hadn't realized was available. Your snippet worked like a charm also.