Click here to Skip to main content
15,883,705 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
IList<Dictionary<string, object>> bookmarks = SimpleBookmark.GetBookmark(pdfReader);
           // var v = bookmarks.OfType <string>().ToArray();
           for (int i = 0; i < bookmarks.Count; i++)
           {




              MessageBox.Show(bookmarks[i].Values.ToArray().GetValue(0).ToString());



But It showing error in conversion Toarray

Error -- "'System.Collections.Generic.Dictionary<string,object>.ValueCollection' does not contain a definition for 'ToArray' and no extension method 'ToArray' accepting a first argument of type "

Please Help.
Posted
Updated 10-Feb-14 3:50am
v4

1 solution

I think you are a little confused.
I just tried it:
C#
Dictionary<string, object> d = new Dictionary<string, object>();
for (int ii = 1; ii < 10; ii++)
    d.Add((ii * 111).ToString(), ii * 11);
Console.WriteLine(d[d.Keys.ToArray()[0]]);
Console.WriteLine(d.Values.ToArray()[0]);
IList<Dictionary<string, object>> bookmarks = new List<Dictionary<string, object>>();
bookmarks.Add(d);
int i = 0;
Console.WriteLine(bookmarks[i].Values.ToArray().GetValue(0).ToString());

And it compiled and ran perfectly...

So what am I doing that is different from you?
 
Share this answer
 
Comments
Ashwani Gusain 11-Feb-14 1:02am    
Hi OriginalGrif

It showing same error In ToArray

"System.Collections.Generic.Dictionary<string,object>.ValueCollection' does not contain a definition for 'ToArray' and no extension method 'ToArray' accepting a first argument of type"
OriginalGriff 11-Feb-14 2:53am    
Ah! Have you been playing your your *using* statements?
Put this back in:
using System.Linq;
And I think it'll work...
Ashwani Gusain 11-Feb-14 3:29am    
Ohh Thank Griff Its working working now...
OriginalGriff 11-Feb-14 3:34am    
You're welcome!
Ashwani Gusain 11-Feb-14 6:24am    
hi griff

can you please help me to find internal links means not external link i done with external links.i pasted code below. please help..\


code for external links. I am using ItextSharp dll.

PdfArray Annots = PageDictionary.GetAsArray(PdfName.ANNOTS);
foreach (PdfObject A in Annots.ArrayList)
{
//Convert the itext-specific object as a generic PDF object
PdfDictionary AnnotationDictionary = (PdfDictionary)PdfReader.GetPdfObject(A);


//Make sure this annotation has a link



if (!AnnotationDictionary.Get(PdfName.SUBTYPE).Equals(PdfName.LINK))
continue;

//Make sure this annotation has an ACTION
if (AnnotationDictionary.Get(PdfName.A) == null)
continue;

//Get the ACTION for the current annotation
PdfDictionary AnnotationAction = AnnotationDictionary.GetAsDict(PdfName.A);
// PdfDictionary AnnotationAction = (PdfDictionary)AnnotationDictionary.Get(PdfName.A);


if (AnnotationAction.Get(PdfName.S).Equals(PdfName.URI))
{

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900