从 ASP.NET MVC XMLHttpRequest 上传后 PDF 缺少签名

Pdf missing signature after uploading from ASP.NET MVC XMLHttpRequest

我正在开发 ASP.NET MVC 页面,让用户在对 Pdf 文档进行数字签名后上传该文档。 但由于某种原因,即使正确显示了图形表示,签名在上传文档时也会被破坏。 这是我用来上传文件的代码:

    $(document).on('click', 'input[value=Upload]', function (e, argument) {
        var formdata = new FormData();
        for (i = 0; i < document.getElementById('FileBox').files.length; i++) {
            formdata.append(document.getElementById('FileBox').files[i].name, document.getElementById('FileBox').files[i]);
        }

        var url = '@Url.Action("Upload", "Test")'

        var xhr = new XMLHttpRequest();
        xhr.open('POST', url);
        xhr.send(formdata);
        xhr.onreadystatechange = function () {
            if (xhr.readyState == 4 && xhr.status == 200) {
                var response = $.parseJSON(xhr.response);
                alert(response.result);
            }
        }
    });

我正在控制器中检索上传的文件,如下所示:

Public Function PostedFiles() As List(Of Byte())
    Dim retval As New List(Of Byte())
    Dim oRequest As HttpRequest = Web.HttpContext.Current.Request
    For Each sFileKey As String In oRequest.Files
        Dim oFile As HttpPostedFile = oRequest.Files(sFileKey)
        If oFile.ContentLength > 0 Then
            Dim iLength As Integer = oFile.ContentLength
            Dim oBytes(iLength) As Byte
            Dim oStream As System.IO.Stream = oFile.InputStream()
            oStream.Read(oBytes, 0, iLength)
            retval.Add(oBytes)
        End If
    Next
    Return retval
End Function

将字节数组保存到 SQL 服务器数据库后,当我从数据库中取回它们时,不再有任何签名,只有它的图形表示。

感谢 Mkl 的评论,我意识到自从文档显示在浏览器中后我没有得到签名。在 Acrobat 中打开持久文件 Reader 成功显示签名。