KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I can not detect blank page in pdf file. I have searched internet for it but could not find a good solution. Using Itextsharp I tried with page size, Xobjects. But they do not give exact result. I tried if(xobjects==null || textcontent==null || size <20 bytes ) then "blank" else not blank But maximum time it returns wrong answer. I have used Itextsharp The code is below... I am using Itextsharp Librabry For xobjects PdfDictionary xobjects = resourceDic.GetAsDict(PdfName.XOBJECT); //here resourceDic is PdfDictionary type //I know that if Xobjects is null then page is blank. But sometimes blank page gives xobjects which is not null. For contentstream RandomAccessFileOrArray f = reader.SafeFile; //here reader = new PdfReader(filename); byte[] contentBytes = reader.GetPageContent(pageNum, f); //I have measured the size of contentbytes but sometimes it gives more than 20 bytes for blank page For textcontent String extractedText = PdfTextExtractor.GetTextFromPage(reader, pageNum, new LocationTextExtractionStrategy()); // sometimes blank page give a text more than 20 char length .
Tags (comma-separated)
Save Edits
Cancel