public static void EnsureLoaded() { lock (SyncRoot) { if (_library == null) { _library = new PdfLibrary(); } } }
public PdfFile(Stream stream, string password) { if (stream == null) { throw new ArgumentNullException(nameof(stream)); } PdfLibrary.EnsureLoaded(); _stream = 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); }