PDFsharp & MigraDoc Foundation https://forum.pdfsharp.net/ |
|
Iterating Annotations from existing pdf https://forum.pdfsharp.net/viewtopic.php?f=2&t=1111 |
Page 1 of 1 |
Author: | BillE [ Tue Mar 23, 2010 6:28 pm ] |
Post subject: | Iterating Annotations from existing pdf |
Hi all, I am trying to walk the annotations list per page in an existing pdf. I have tried various permutations of the following foreach loops in C# Code: foreach (PdfPage page in pdf.Pages) { PdfAnnotations annots = page.Annotations; PdfArray annArray = annots; foreach (var ann in annArray) { } } Every variation recives an invalid cast error Unable to cast object of type 'AnnotationsIterator' to type 'System.Collections.Generic.IEnumerator`1[PdfSharp.Pdf.PdfItem]' I can get around this by walking the document internal looking for dictionaries that are /Annot /Link. but that looses page affinity. any thoughts on how to get around this. Bille |
Author: | RichardD [ Thu May 27, 2010 11:53 am ] |
Post subject: | Re: Iterating Annotations from existing pdf |
This is a bug introduced in v1.31:
Unfortunately, short of switching to v1.2, the only solution is to iterate by hand: Code: for (int index = 0; index < page.Annotations.Count; index++)
{ var ann = page.Annotations[index]; ... } |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |