public PdfBufferFile(byte[] buffer, int length) { if (buffer == null) { throw new ArgumentNullException("buffer"); } _buffer = buffer; _length = length; LoadDocument(NativePdfiumMethods.FPDF_LoadMemDocument(_buffer, length, null)); }
protected PdfFileHandleFile(SafeHandle handle, int length) { if (handle == null) { throw new ArgumentNullException("handle"); } _mappedHandle = NativeMethods.CreateFileMapping(handle, IntPtr.Zero, NativeMethods.FileMapProtection.PageReadonly, 0, (uint)length, null); if (_mappedHandle.IsInvalid) { throw new Win32Exception(); } _buffer = NativeMethods.MapViewOfFile(_mappedHandle, NativeMethods.FileMapAccess.FileMapRead, 0, 0, (uint)length); if (_buffer.IsInvalid) { throw new Win32Exception(); } LoadDocument(NativePdfiumMethods.FPDF_LoadMemDocument(_buffer, length, null)); }