Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
Getting Annotation Infos: what am I doing wrong ? |
Post Reply |
Author | |
rmac
Beginner Joined: 29 Apr 07 Location: Germany Status: Offline Points: 5 |
Post Options
Thanks(0)
Posted: 30 Apr 07 at 12:36PM |
Hi all,
maybe only a stupid newbie question, but...
I'm trying to get appropriate link infos from page annotations to integrate PDF viewer functionality in my app.
But I don't get (all necessary) infos from annotations when using GetAnnot*Property (!?!) except these:
- "GetAnnotDblProperty" with Left,Top,Width and Height works perfectly (to draw a frame around the annotation)
- "GetAnnotStrProperty" with Annotation type (101) says "LINK"
That's all.... I don't get any infos on the ref.document, page or anything...
I already tested the functions for (possibly) undocumented TagIDs but without success.
Many thx in advance for any hints/ideas
rmac
|
|
marian_pascalau
Debenu Quick PDF Library Expert Joined: 28 Mar 06 Location: Germany Status: Offline Points: 278 |
Post Options
Thanks(0)
|
I have no time to do more research for you but this may be a starting point for you. This should wotk with all 5.2* Versions.
Best regards, Marian
procedure TPDFViewerForm.imgPdfPageMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
type TRectangleF = record Left, Top, Width, Height: Double; end; TPointF = record X, Y : Double; end; function RectangleF(Left, Top, Width, Height: Double) : TRectangleF;
begin Result.Left := Left; Result.Top := Top; Result.Width := Width; Result.Height := Height; end; function PointF(X, Y : Double) : TPointF;
begin Result.X := X; Result.Y := Y; end; function Contains(Rect: TRectangleF; Point : TPointF) : Boolean;
begin Result := (Point.X >= Rect.Left) and (Point.X <= (Rect.Left + Rect.Width)) and (Point.Y >= Rect.Top) and (Point.Y <= (Rect.Top + Rect.Height)); end; procedure MultDiv(var Rect : TRectangleF; nMult, nDiv : Double); overload;
begin Rect.Left := Rect.Left * nMult / nDiv; Rect.Top := Rect.Top * nMult / nDiv; Rect.Width := Rect.Width * nMult / nDiv; Rect.Height := Rect.Height * nMult / nDiv; end; procedure MultDiv(var Point : TPointF; nMult, nDiv : Double); overload;
begin Point.X := Point.X * nMult / nDiv; Point.Y := Point.Y * nMult / nDiv; end; procedure DeviceToSpaceCoordinates(Pdf : IQuickPDF2; var Rect : TRectangleF); overload;
begin MultDiv(Rect, PageResolution, STD_DPI); Rect.Top := Pdf.PageHeight - Rect.Top - Rect.Height; end; procedure DeviceToSpaceCoordinates(Pdf : IQuickPDF2; var Point : TPointF); overload;
begin Point.Y := Pdf.PageHeight - Point.Y; MultDiv(Point, PageResolution, STD_DPI); end; var nCount : Integer; nIndex : Integer; strPrp : string; intDst : Integer; strDst : string; rect : TRectangleF; point : TPointF; begin if IsEmpty then Exit; point := PointF(x, y); DeviceToSpaceCoordinates(Pdf, point); //Log_Message('<AnnotationCheck>');
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; //Log_Message('</AnnotationCheck>'); end; |
|
rmac
Beginner Joined: 29 Apr 07 Location: Germany Status: Offline Points: 5 |
Post Options
Thanks(0)
|
Marian,
thanks for your fast response.
I've installed Ver. 5.21 (Delphi5 DCUs) and now GetAnnotIntProperty(..., 111/112) seems to give reasonable infos. Thx again....
But now I have two other problem (which I had before when testing Ver. 5.21, so I switched back to 5.14 which doesn't have this problems!):
1. (big) parts of text are NOT rendered; I guess it has something to do with the font settings because some text and (all) graphics are drawn. I tried "ReplaceFonts" without success....
2. If I load (for example) "iSEDQuickPDF 5.11 Reference Guide.pdf" it takes remarkably longer until the first page is displayed with Ver. 5.21.
5.14 is much faster here.
Any ideas ?
Thx and best regards
rmac
|
|
marian_pascalau
Debenu Quick PDF Library Expert Joined: 28 Mar 06 Location: Germany Status: Offline Points: 278 |
Post Options
Thanks(0)
|
Hi rmac,
I am sorry for you but support for version 5.14 I will not offer anymore. In case you have really a problem you should publish your information and I will check it myself.
About the loading of iSEDQuickPDF 5.11 I know that there is a problem. During an optimization for caching the PDF page dictionaries we introduce a new decryption problem which was not corrected in Version 5.21 and 5.22.
About performance on the first look I have only one statement. The loading of PDF documents was optimized for huge PDF files. This force me to implementent caching and some mecanisms which introduce some how of overhead. For small documents this is a performance penalty but big ones a golden stuff.
In case you want to know more exactly what is happening you should publish your problem first and then we can discuss more in detail.
Best regards, Marian
|
|
rmac
Beginner Joined: 29 Apr 07 Location: Germany Status: Offline Points: 5 |
Post Options
Thanks(0)
|
Hi Marian, sorry for the late reply but it has been a busy week.... The loading of "iSEDQuickPDF 5.11.pdf" is not a real problem for me, because in most cases I have to deal with mid- to huge-size documents (800+ pages) with less image content. Loading of these documents is quite good (golden stuff as you said ) Well the rendering problem is a real ugly thing. I suppose it's a font problem but I don't have any idea because my understanding of the PDF structure/rendering is nearly null... Here are two images of the same document page to illustrate the problem. <images removed>
I don't have any clue, so some expert advice would be very helpful here. Unfortunately I don't have the sources so I can't do more research on my own. TIA for any suggestions Edited by rmac - 14 May 07 at 10:52AM |
|
marian_pascalau
Debenu Quick PDF Library Expert Joined: 28 Mar 06 Location: Germany Status: Offline Points: 278 |
Post Options
Thanks(0)
|
rmac,
your information is not very usefull. It may be true that you are right but without the orginal PDF document I cannot confirm your problem.
Please publish the location of your PDF file or send a copy to support(at)quickpdf.org.
|
|
rmac
Beginner Joined: 29 Apr 07 Location: Germany Status: Offline Points: 5 |
Post Options
Thanks(0)
|
Hi Marian,
my thought was that I made an obvious mistake and that someone/you could point my in the right direction by simply looking at the example images...
I send a similar PDF example to support(at)quickpdf.org which also shows no text at all when rendered with 5.21.
BTW: my "opening-sequence" is as simple as that:
UnlockKey('...');
LoadFromFile('...'); SetGDIPlusOptions(1,1);
SetMeasurementUnits(1); Unencrypt;
and then rendering the page with
SelectPage(APageIndex);
RenderPageToStream(100, APageIndex, 0, AMemStream); Image.Picture.Graphic.LoadFromStream(AMemStream);
Thx a lot for your time to look
rmac
|
|
marian_pascalau
Debenu Quick PDF Library Expert Joined: 28 Mar 06 Location: Germany Status: Offline Points: 278 |
Post Options
Thanks(0)
|
rmac,
the call sequence you mentioned here is correct. If you are right then there is a problem with QuickPDF 5.21 version. At the moment my private version 5.23 works without problem.
More details I have sent you per email.
Best regards, Marian
|
|
rmac
Beginner Joined: 29 Apr 07 Location: Germany Status: Offline Points: 5 |
Post Options
Thanks(0)
|
Hi Marian,
thanks for your suggestions.
As the are no DCU files for version 5.22 yet, I've wrote a wrapper for my needed functions to access the 5.22 DLL directly.
With 5.22 all the text was rendered perfectly but then my old problem with the missing annotations info re-appeared....
For some documents it works (as you suggested) but unfortunately not for all.
I think I've done enough research on that thing without success and so I'm going to experiment with the Acrobat ActiveX respectively DDE controlled Acrobat Reader. I suppose for my purposes (just viewing pdf) it's the more painless approach...
Thx anyway for your contributions and good luck to you all
rmac
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store