private static int FPDF_SaveBlock(IntPtr fileWrite, IntPtr data, uint size)
        {
            var write = new FPDF_FILEWRITE();

            Marshal.PtrToStructure(fileWrite, write);

            var stream = StreamManager.Get((int)write.stream);

            if (stream == null)
            {
                return(0);
            }

            var buffer = new byte[size];

            Marshal.Copy(data, buffer, 0, (int)size);

            try
            {
                stream.Write(buffer, 0, (int)size);
                return((int)size);
            }
            catch
            {
                return(0);
            }
        }
        private static int FPDF_GetBlock(IntPtr param, uint position, IntPtr buffer, uint size)
        {
            var stream = StreamManager.Get((int)param);

            if (stream == null)
            {
                return(0);
            }
            var managedBuffer = new byte[size];

            stream.Position = position;
            var read = stream.Read(managedBuffer, 0, (int)size);

            if (read != size)
            {
                return(0);
            }

            Marshal.Copy(managedBuffer, 0, buffer, (int)size);
            return(1);
        }