vb.net - How to remove blank pages from PDF using PDFSHarp? -


how able remove blank page pdf file? have sample pdf file 1st page contains few strings , 2nd page absolutely nothing in it. tried loop pdf pages , element count per page funny thing same number between 2 pages =| how did happen if 1st page has few strings , 2nd page absolutely blank???

this code

dim inputdocument pdfdocument = pdfreader.open("") dim elemountcount integer = 0 dim elemountcount2 integer = 0 dim pdfpagecount integer = inputdocument.pagecount

for x integer = 0 pdfpagecount - 1 elemountcount = inputdocument.pages(x).contents.elements.count elemountcount2 = inputdocument.pages(x).elements.count next

try check length of each element:

public bool hascontent(pdfpage page) {     for(var = 0; < page.contents.elements.count; i++)     {         if (page.contents.elements.getdictionary(i).stream.length > 76)         {             return true;         }     }     return false; } 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -