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!
Create bookmark tree using Delphi |
Post Reply |
Author | |
Rowan
Moderator Group Joined: 10 Jan 09 Status: Offline Points: 398 |
Post Options
Thanks(0)
Posted: 27 Mar 12 at 8:50AM |
This sample code has been contributed by a Quick PDF Library customer. //=================== START Delphi 7 OutLine Code tvOutLine:TTreeView; // calling code is: GetAllOutlines(nil, QP.GetFirstOutline, 1, 3); // this function is only needed to get the selected page number when dblclicking on the node function FindLastChar(const S: AnsiString; Ch: Char = #32): Integer; asm test eax, eax jz @@30 mov ecx, [eax - 4] test ecx, ecx @@10: jz @@30 mov dh, [eax + ecx] cmp dl, dh jne @@20 mov eax, ecx inc eax ret @@20: dec ecx jmp @@10 @@30: xor eax, eax dec eax end; procedure TfrmPdfReader.GetAllOutlines(nNode: TTreeNode; id, level, maxlevel: Integer); var inPage, inID: Integer; rNode, cNode: TTreeNode; begin if (level > maxlevel) then exit; while (id <> 0) do begin inPage := QP.GetOutlinePage(id); rNode := tvOutLine.Items.Add(nNode, QP.OutlineTitle(id) + ' ' + ' p.' + IntToStr(inPage)); inID := QP.GetFirstChildOutline(ID); if (inID <> 0) then begin cNode := tvOutLine.Items.AddChild(rNode, QP.OutlineTitle(inid) + ' ' + ' p.' + IntToStr(inPage)); GetAllOutlines(cNode, QP.GetFirstChildOutline(id), level + 1, maxlevel); end; id := QP.GetNextOutline(id); end; end; procedure TfrmPdfReader.tvOutlineDblClick(Sender: TObject); var inPos, inPage: Integer; stPage: AnsiString; begin inPos := FindLastChar(tvOutLine.Selected.Text, '.'); stPage := copy(tvOutLine.Selected.Text, inPos + 1, 4); if TryStrToInt(stPage, inPage) then RenderPageToImage(QP,inPage,ImgPreview,ZoomPercentage: Integer); end; // ============= END Delphi Outline code ===========
|
|
ginganinja1
Beginner Joined: 25 Oct 12 Location: United Kingdom Status: Offline Points: 2 |
Post Options
Thanks(0)
|
Hi
I was wondering if it was possible to make the page number displayed in the tree view invisible as I don't wont them to show as the page numbers on my bookmarks do not correspond the the page numbers displayed in the PDF document. Thanks
|
|
Guy
Beginner Joined: 25 Jun 16 Location: Australia Status: Offline Points: 2 |
Post Options
Thanks(0)
|
Having a problem with this code...
It adds the first node of each parent twice...any clues. Guy
|
|
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