PDFShellServerLib Error

Larry Brister
Larry Brister used Ask the Experts™
on
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
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2012
Top Expert 2014

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

Author

Commented:
CodeCruiser
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?
Most Valuable Expert 2012
Top Expert 2014

Commented:
Where did you get this code? What are you trying to achieve?
Learn Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Larry Bristersr. Developer

Author

Commented:
From one of the links you posted to me about 3 weeks ago at http://www.experts-exchange.com/Programming/Languages/.NET/Q_27699064.html
Most Valuable Expert 2012
Top Expert 2014
Commented:
Have you tried the iText approach in 3rd link?

http://www.vbforums.com/showthread.php?t=558076
Larry Bristersr. Developer

Author

Commented:
That did it
Thanks

Here's my solution

  Private Sub rcbFolderList_SelectedIndexChanged(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles rcbFolderList.SelectedIndexChanged
       
 rgExportFiles.Rebind()
        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
                summary.ImportRow(dr)
            Next
        Next
        lblMessagePDF.Text = summary.Rows.Count & "  Files in the   " & rcbFolderList.SelectedValue & "  Folder"
        rgExportFiles.DataSource = summary
        rgExportFiles.DataBind()
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
        Try

            '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
            Next
            summary.Rows.Add(row)
            reader.Close()
        Catch ex As Exception
            Debug.Write(ex.Message)
        End Try
        Return summary
    End Function

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial