Creating a Wrapper Assembly

Aspose.PDF for .NET Wrapper

using System;
using System.Runtime.InteropServices;

namespace PdfText
{
    [Guid("FC969AC9-6591-46FB-A4AB-DB12A776F3BF")]
    [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
    public interface IPetriever
    {
        [DispId(1)]
        void SetLicense(string file);

        [DispId(2)]
        string GetText(string file);
    }

    [Guid("3D59100F-3CC5-463D-B509-58FA0520B436")]
    [ClassInterface(ClassInterfaceType.None)]

    [ComSourceInterfaces(typeof(IPetriever))]

    public class Petriever : IPetriever
    {
        public void SetLicense(string file)
        {
            License lic = new License();
            lic.SetLicense(file);
        }

        public string GetText(string file)
        {
            // open document
            Document doc = new Document(file);

            // create TextAbsorber object to extract text
            TextAbsorber absorber = new TextAbsorber();

            // accept the absorber for all document's pages
            doc.Pages.Accept(absorber);

            // get the extracted text

            string text = absorber.Text;
            return text;

        }
    }
}