Print Page | Close Window

Get link coordinates and target

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=784
Printed Date: 19 May 24 at 3:55PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Get link coordinates and target
Posted By: bboldi
Subject: Get link coordinates and target
Date Posted: 12 Sep 07 at 6:19AM
Does QPDF has any function that helps me get the links from a page (tarket -> inner or extern - http or mailto) , and the Rect of the link (x,y,w,h)... I would like to create clickable areas for the rendered page... Thanks for the help in advance.



Replies:
Posted By: marian_pascalau
Date Posted: 12 Sep 07 at 8:56AM

Yes there are functions for this purpose. This is a small code snipped which may give you some clues:

 
    nCount := Pdf.AnnotationCount;
    for nIndex := 1 to nCount do
    begin
        try
            strPrp := string(Pdf.GetAnnotStrProperty(nIndex, 101));
            if CompareText(strPrp, 'Link') <> 0 then
                Continue;
            rect  := RectangleF(
                Pdf.GetAnnotDblProperty(nIndex, 105),
                Pdf.GetAnnotDblProperty(nIndex, 106),
                Pdf.GetAnnotDblProperty(nIndex, 107),
                Pdf.GetAnnotDblProperty(nIndex, 108));
            if not Contains(rect, point) then
                Continue;
            //Log_MessageFmt('%n:%n:%n:%n - %n:%n', [rect.Left, rect.Top, rect.Left + rect.Width, rect.Top + rect.Height, point.X, point.Y]);
            MessageBeep(MB_ICONEXCLAMATION);
            case Pdf.GetAnnotIntProperty(nIndex, 111) of
            0, 1:
              begin
                intDst := Pdf.GetAnnotIntProperty(nIndex, 112);
                if intDst > 0 then
                begin
                    {$IFDEF _DEBUG}
                    intDst := Pdf.GetDestPage(intDst);
                    LogMessageFmt('Link[%d]->GotoPage: %d', [nIndex, intDst]);
                    {$ENDIF}
                end;
              end;
            4, 6:
              begin
                strDst := Pdf.GetAnnotStrProperty(nIndex, 112);
                {$IFDEF _DEBUG}
                LogMessageFmt('Link[%d]->Launch: %s', [nIndex, strDst]);
                {$ENDIF}
              end;
            end;
        except
        end;
    end;
Best regards, Marian


Posted By: bboldi
Date Posted: 12 Sep 07 at 10:04AM
Thanks. You helped a lot.


Posted By: marian_pascalau
Date Posted: 12 Sep 07 at 10:19AM
You are welcome



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