Avatar of Larry Brister
Larry Brister
Flag for United States of America asked on

PDFShellServerLib Error

After retrievinf a snippet I placed the code below in my sub.
However it is throwing an exception error
The error is at the bottom

    Protected Sub getPDF_Info()
        Dim pdfinfo As New PDFSHELLSERVERLib
        Dim title As String, subj As String, author As String, keyword As String
        title = Nothing
        subj = Nothing
        author = Nothing
        keyword = Nothing
        pdfinfo.GetColumnInfo("DisclosureConsent.pdf", title, subj, author, keyword)
        lblMessagePDF.Text = "Title:" & title & " | Subject:" & subj & " | Author:" & author & " | Keyword:" & keyword
    End Sub

The method or operation is not implemented.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NotImplementedException: The method or operation is not implemented.

Source Error:

Line 3:  
Line 4:      Sub GetColumnInfo(ByVal p1 As String, ByVal title As String, ByVal subj As String, ByVal author As String, ByVal keyword As String)
Line 5:          Throw New NotImplementedException
Line 6:      End Sub
Line 7:  

Source File: D:\Documents and Settings\lbrister\my documents\visual studio 2010\Projects\DevWeb\DevWeb\PDFSHELLSERVERLib.vb    Line: 5

Stack Trace:

[NotImplementedException: The method or operation is not implemented.]
   DevWeb.PDFSHELLSERVERLib.GetColumnInfo(String p1, String title, String subj, String author, String keyword) in D:\Documents and Settings\lbrister\my documents\visual studio 2010\Projects\DevWeb\DevWeb\PDFSHELLSERVERLib.vb:5
   DevWeb.getDirectory.getPDF_Info() in D:\Documents and Settings\lbrister\my documents\visual studio 2010\Projects\DevWeb\DevWeb\getDirectory.aspx.vb:117
   DevWeb.getDirectory.Page_Load(Object sender, EventArgs e) in D:\Documents and Settings\lbrister\my documents\visual studio 2010\Projects\DevWeb\DevWeb\getDirectory.aspx.vb:21
   System.Web.UI.Control.OnLoad(EventArgs e) +91
   System.Web.UI.Control.LoadRecursive() +74
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
.NET ProgrammingVisual Basic.NETMicrosoft Development

Avatar of undefined
Last Comment
Larry Brister

8/22/2022 - Mon
Nasir Razzaq

Error is self explanatory really. The method GetColumnInfo has been inherited from an interface but not implemented so you can't use it.
Larry Brister

Ok.  I recognized all your words...and you've helped me a LOT over the years and I appreciate it.

How do I correct that?
Nasir Razzaq

Where did you get this code? What are you trying to achieve?
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Larry Brister

From one of the links you posted to me about 3 weeks ago at https://www.experts-exchange.com/Programming/Languages/.NET/Q_27699064.html
Nasir Razzaq

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Larry Brister

That did it

Here's my solution

  Private Sub rcbFolderList_SelectedIndexChanged(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles rcbFolderList.SelectedIndexChanged
        Dim dirInfo As New DirectoryInfo(rcbFolderList.SelectedValue)
        Dim summary As New DataTable()
        With summary.Columns
            .Add("FullName", GetType(String))
            .Add("FileName", GetType(String))
            .Add("PageCount", GetType(Integer))
            .Add("PageSize", GetType(String))
            .Add("Title", GetType(String))
            .Add("Author", GetType(String))
            .Add("Subject", GetType(String))
        End With
        For Each File In dirInfo.GetFiles
            Dim dt As DataTable
            dt = GetPdfSummary(File.FullName)
            For Each dr As DataRow In dt.Rows
        lblMessagePDF.Text = summary.Rows.Count & "  Files in the   " & rcbFolderList.SelectedValue & "  Folder"
        rgExportFiles.DataSource = summary
End Sub

 Public Shared Function GetPdfSummary(ByVal sourcePdf As String) As DataTable
        Dim summary As New DataTable()
        With summary.Columns
            .Add("FullName", GetType(String))
            .Add("FileName", GetType(String))
            .Add("PageCount", GetType(Integer))
            .Add("PageSize", GetType(String))
            .Add("Title", GetType(String))
            .Add("Author", GetType(String))
            .Add("Subject", GetType(String))
        End With

            'Open the pdf using pdfreader and get summary data
            Dim raf As iTextSharp.text.pdf.RandomAccessFileOrArray = New iTextSharp.text.pdf.RandomAccessFileOrArray(sourcePdf)
            Dim reader As iTextSharp.text.pdf.PdfReader = New iTextSharp.text.pdf.PdfReader(raf, Nothing)
            Dim row As DataRow = summary.NewRow()
            row("FullName") = System.IO.Path.GetFullPath(sourcePdf)
            row("FileName") = System.IO.Path.GetFileName(sourcePdf)
            row("PageCount") = reader.NumberOfPages()
            Dim rect As iTextSharp.text.Rectangle = reader.GetPageSize(1)
            row("PageSize") = String.Format("{0} x {1} in", (rect.Width / 72).ToString("f2"), (rect.Height / 72).ToString("f2"))
            Dim info As Dictionary(Of String, String) = reader.Info

            For Each key As String In info.Keys
                Select Case key
                    Case "FullName"
                        row("FullName") = info.Item(key)
                    Case "Title"
                        row("Title") = info.Item(key)
                    Case "Author"
                        row("Author") = info.Item(key)
                    Case "Subject"
                        row("Subject") = info.Item(key)
                End Select
        Catch ex As Exception
        End Try
        Return summary
    End Function