Пример #1
0
        public static InMemoryPdfDocument Open(Stream stream, string password = null)
        {
            using var memoryStream = new MemoryStream();
            stream.CopyTo(memoryStream);
            byte[] buffer = memoryStream.ToArray();
            var    handle = GCHandle.Alloc(buffer, GCHandleType.Pinned);

            NativeMethods.DocumentHandle documentHandle = NativeMethods.LoadDocument(handle.AddrOfPinnedObject(), buffer.Length, password);
            return(new InMemoryPdfDocument(documentHandle, handle));
        }
Пример #2
0
 internal InMemoryPdfDocument(NativeMethods.DocumentHandle documentHandle, GCHandle handle)
     : base(documentHandle)
 {
     _handle = handle;
 }
Пример #3
0
 internal PdfDocument(NativeMethods.DocumentHandle documentHandle)
 {
     _documentHandle = documentHandle;
 }