We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Using the PDF library how do I access the Catalog portion of a PDF?

I'm trying to access the Catalog inside a PDF. With the former library we used (itext) it was available but with the Syncfusion library I am able to see it but not retrieve it as an object because it is marked as a "Friend"

What is the equivalent with the Syncfusion libraries?

The old code using iText:

Dim reader As New PdfReader(TempPdfFileName) 
Dim catalog As PdfDictionary = reader.Catalog

5 Replies

SK Surya Kumar Syncfusion Team August 19, 2019 01:10 PM UTC

Hi John, 
Greetings from Syncfusion. 
The API for catalog dictionary of the PDF is not exposed in our library, could you please let us know what operation you are trying to perform after accessing the catalog, so that we can help you with the same. 
Kindly refer our UG documentation to know more about the same: 

Surya Kumar 

JS John Stemper August 19, 2019 03:35 PM UTC

There is a "custom" section in the PDFs that I am working with that contains a string of XML. The previous code using iText I was able to get the catalog dictionary and find the string by it's name in the catalog. 
The section of the catalog that I am trying to get at is highlighted below.

SL Sowmiya Loganathan Syncfusion Team August 20, 2019 01:48 PM UTC

Hi John, 

As we have said earlier, we do not have support to get the catalog dictionary of the PDF document in our library. We have already logged a feature request for this. Currently we do not have any immediate plans to implement this feature. Please let us know if you have any concerns on this.  

Sowmiya L 

JS John Stemper August 22, 2019 01:40 PM UTC

My management is asking why the catalog is not accessible in the Syncfusion libraries when it was available in the previous ,iText libraries?

Is there a alternative way to access the information that is contained in the Catalog?


SL Sowmiya Loganathan Syncfusion Team August 23, 2019 01:22 PM UTC

Hi John, 
As we said earlier, we do not have support to access the low level objects in our PDF library. And we do not have any immediate plan to expose the low level API publicly. So we suggest you to use the Reflection API to get the internal objects as stated like below. 
//Load the existing PDF document. 
PdfLoadedDocument pdfLoadedDocument = new PdfLoadedDocument(@"input.pdf"); 
//Get all the document properties. 
PropertyInfo[] documentProperties = pdfLoadedDocument.GetType().GetProperties(BindingFlags.Instance | 
                        BindingFlags.NonPublic | 
foreach (PropertyInfo property in documentProperties) 
    //Get the PDF Catalog object 
    if (property.Name == "Catalog") 
        //Get PdfCatalog 
        object catalogProps = property.GetValue(pdfLoadedDocument, null); 
        //Get all the catalog properties. 
        PropertyInfo[] catalogProperties = catalogProps.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); 
        foreach (PropertyInfo prop in catalogProperties) 
              //Get the items property. 
              if (prop.Name == "Items") 
                   //Get Items. 
                   IDictionary ss = prop.GetValue(catalogProps, null) as IDictionary; 
                   foreach (var key in ss.Keys) 
                       //Catalog dictionary values. 
                       object value = ss[key]; 
Sowmiya L 

Live Chat Icon For mobile
Up arrow icon