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!
Find all annotations in a PDF |
Post Reply |
Author | |
Rowan
Moderator Group Joined: 10 Jan 09 Status: Offline Points: 398 |
Post Options
Thanks(0)
Posted: 25 Sep 09 at 8:13AM |
Programmatically retrieving a list of all the various annotations stored inside a PDF is pretty easy when using the AnnotationCount and GetAnnotStrProperty with Quick PDF Library. An example of how to do this is shown below in C# and Delphi. C# Sample Code: --- QP.LoadFromFile(txtFilePath.Text); for (int i = 1; i <= QP.PageCount(); i++) { QP.SelectPage(i); txtLog.Text = txtLog.Text + "Page " + Convert.ToString(i) + " has " + QP.AnnotationCount() + " annotations." + "\r\n" + "\r\n"; for (int d = 1; d < QP.AnnotationCount(); d++) { string AnnotType = QP.GetAnnotStrProperty(d, 101); txtLog.Text = txtLog.Text + AnnotType + "\r\n"; } } --- Delphi Sample Code: --- Memo5.Lines.BeginUpdate; Memo5.Lines.Clear; ProgressBar1.Max := QP.PageCount; for Page := 1 to QP.PageCount do begin QP.SelectPage(Page); ProgressBar1.Position := Page; Memo5.Lines.Add('Page ' + IntToStr(Page) + ' has ' + IntToStr(QP.AnnotationCount) + ' annotations'); for AnnotIndex := 1 to QP.AnnotationCount do begin AnnotType := QP.GetAnnotStrProperty(AnnotIndex, 101); Memo5.Lines.Add('Annot number ' + IntToStr(AnnotIndex) + ' on this page has type: ' + AnnotType); end; Memo5.Lines.Add(''); end; --- |
|
Rowan
Moderator Group Joined: 10 Jan 09 Status: Offline Points: 398 |
Post Options
Thanks(0)
|
This is an enhanced version of the Delphi Sample Code:
--- QP := TQuickPDFQVer.Create; try QP.UnlockKey(' ... '); QP.LoadFromFile('annots.pdf'); for Page := 1 to QP.PageCount do begin QP.SelectPage(Page); Memo1.Lines.Add('Page ' + IntToStr(Page)); for AnnotationIndex := 1 to QP.AnnotationCount do begin Memo1.Lines.Add(' Annotation ' + IntToStr(AnnotationIndex)); Memo1.Lines.Add(' Type: ' + QP.GetAnnotStrProperty( Memo1.Lines.Add(' Contents: ' + QP.GetAnnotStrProperty( Memo1.Lines.Add(' Name: ' + QP.GetAnnotStrProperty( Memo1.Lines.Add(' Subject: ' + QP.GetAnnotStrProperty( Memo1.Lines.Add(' Left: ' + FormatFloat('0.00', QP.GetAnnotDblProperty( Memo1.Lines.Add(' In reply to: ' + FormatFloat('0.00', QP.GetAnnotIntProperty( end; end; ---
|
|
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