Print Page | Close Window

"Phantom" Images

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=3614
Printed Date: 22 Nov 24 at 1:43PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: "Phantom" Images
Posted By: John Whitham
Subject: "Phantom" Images
Date Posted: 04 Oct 18 at 4:38PM
I use the following code in a MouseUp event on a TPaintbox to find if the user has selected an image in the underlying pdf

    ...imgl := pdfdoc.GetPageImageList(0);
    if imgl > 0 then
    begin
      dpi := paintbox2.Height / (pdfdoc.PageHeight /25.4);
      curpos := point(x,y);
      cx := curpos.X / dpi * 25.4;
      cy := curpos.Y / dpi * 25.4;
      for i := 1 to pdfdoc.GetImageListCount(imgl) do
      begin
        il := pdfdoc.GetImageListItemDblProperty(imgl,i,501);
        it := pdfdoc.GetImageListItemDblProperty(imgl,i,502);
        ir := pdfdoc.GetImageListItemDblProperty(imgl,i,503);
        ib := pdfdoc.GetImageListItemDblProperty(imgl,i,506);
        if (cx >= il) and (cx <= ir) and (cy >= it) and (cy <= ib) then
          break;
      end;
      if i <= pdfdoc.GetImageListCount(imgl) then...

this works fine initially, but after calling pdfdoc.ClearImage() on some moved or deletedimages it starts finding images where there are none. I suspect it finds where they used to be. Can anyone confirm this?



Replies:
Posted By: John Whitham
Date Posted: 04 Oct 18 at 4:44PM
Replying to myself as no edit function: Delphi 10.2.3 Tokyo and QuickPDF 13.12


Posted By: John Whitham
Date Posted: 04 Oct 18 at 5:49PM
Solved it! pdfdoc.GetImageListItemIntProperty(imgl,i,401) returns 1 on a cleared image so it can be discounted.



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