Skip to content
Guides

This sample shows how to load document by stream:

C#
using ComPDFKit.PDFDocument;

namespace TextSearchTest
{
    internal class TextSearch
    {
        static void Main(string[] args)
        {
            #region Perparation work

            Console.WriteLine("Running Stream Load test sample…\r\n");
            bool statue = SDKLicenseHelper.LicenseVerify();
            #endregion

            #region Sample 1: Open Local File With Stream
            if (statue && File.Exists("PDF32000_2008.pdf"))
            {
                FileStream fs = File.OpenRead("PDF32000_2008.pdf");
                CPDFDocument pdfDoc = CPDFDocument.InitWithStream(fs);
                if (pdfDoc != null)
                {
                    Console.WriteLine("Load File With Stream Done.");
                    pdfDoc.Release();
                    fs.Close();
                }
            } 
            #endregion 
            Console.WriteLine("Done.");
            Console.WriteLine("--------------------");

            Console.ReadLine();
        }
    }
}