Print Page | Close Window

How to determine if page is blank?

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=820
Printed Date: 10 May 24 at 9:55AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: How to determine if page is blank?
Posted By: JanN
Subject: How to determine if page is blank?
Date Posted: 23 Nov 07 at 10:44AM
Hi!

I need to check if a page of an existing pdf file is completely blank. Well, of cource I can check the page text. But how about images? The function ImageCount is not applicable.

Any ideas? I already thought about using the GetPageContent function. But my knowledge about the structure is very limited.

Any help is greatly appreciated.

Regards
Jan



Replies:
Posted By: Ingo
Date Posted: 23 Nov 07 at 5:10PM
Hi Jan!

I do it this way ...

With this code i read the pdf-content into a string:

   textkomplett := '';
   fs := TFileStream.Create(Edit1.Text,fmOpenRead+fmShareDenyWrite);
   try
     SetLength(textkomplett,fs.Size);
     fs.Read(PChar(textkomplett)^,fs.Size);
   finally
     fs.Free;
   end;

If i'm searching for images inside the content must be the tag "/Image":

    If Pos('/Image', textkomplett) > 0 Then
       mibi.Text := 'Yes'
      Else
       mibi.Text := 'No';

Best regards,
Ingo



Posted By: JanN
Date Posted: 24 Nov 07 at 9:52AM
Hi Ingo!

Thanks for your reply.

But the way you do it only tells me if there are any images in the pdf file. So far so well. But I need to know if one of the images is used for one specific page.

Perhaps this is possible by getting the object numbers of the images and check if they are referenced to in the page.


Posted By: JanN
Date Posted: 05 Dec 07 at 8:03AM
One last try.

I haven't been successful, yet. My knowledge of the pdf structure is not sufficient for solving this problem.

Does anyone have another idea or perhaps a piece of code Wink?

Best regards,
Jan


Posted By: krom
Date Posted: 06 Dec 07 at 9:27AM
h:=QP.DAOpenFile(filename);
p:=QP.DAFindPage(h,pagenum);
imlist:=QP.DAGetPageImageList(h,p);
imcnt:=QP.DAGetImageListCount(h,imlist);
if imcnt=0 then 'No images'


Posted By: JanN
Date Posted: 06 Dec 07 at 10:06AM
Thanks for that reply. Once again a surprise what the DA-functions are able to do.

Best regards,
Jan



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk