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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

146738 Aug 16,2019 01:59 PM UTC Aug 23,2019 01:22 PM UTC WinForms 5
loading
Tags: PDF
John Stemper
Asked On August 16, 2019 08:41 PM UTC

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



Surya Kumar [Syncfusion]
Replied On 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: 

Regards, 
Surya Kumar 


John Stemper
Replied On 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.



Sowmiya Loganathan [Syncfusion]
Replied On 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.  

Regards, 
Sowmiya L 


John Stemper
Replied On 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?

Thanks

Sowmiya Loganathan [Syncfusion]
Replied On 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 | 
                        BindingFlags.Public); 
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]; 
                   } 
                   break; 
               } 
        } 
        break; 
    } 
} 
             
 
Regards, 
Sowmiya L 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon