public static void EnsureLoaded() { lock (_syncRoot) { if (_library is null) { _library = new PdfLibrary(); } } }
private void LoadFile(Stream stream, string password) { PdfLibrary.EnsureLoaded(); _stream = stream ?? throw new ArgumentNullException(nameof(stream)); _id = StreamManager.Register(stream); var document = NativeMethods.FPDF_LoadCustomDocument(stream, password, _id); if (document == IntPtr.Zero) { throw new PdfException((PdfError)NativeMethods.FPDF_GetLastError()); } LoadDocument(document); }