예제 #1
0
        public PdfObject(Stream pdfStream, string password)
        {
            if (pdfStream == null)
            {
                throw new ArgumentNullException(nameof(pdfStream));
            }

            PdfiumLibrary.Init();

            _stream   = pdfStream;
            _streamId = StreamDictionary.Add(pdfStream);

            var document = PdfiumLibrary.FPDF_LoadCustomDocument(pdfStream, password, _streamId);

            if (document == IntPtr.Zero)
            {
                throw new PdfException(PdfiumLibrary.FPDF_GetLastError());
            }

            LoadDocument(document);
        }