阅读 ASP.NET 中的可填写 PDF 表单字段

Read Fillable PDF form fields in ASP.NET

我有一个使用 Adob​​e Acrobat DC 创建的可填写 PDF 表单,我想将此表单提交给 URL:http://localhost:49168/WebForm1.aspx

我正在使用 Aspose.Pdf 库在我的代码中读取 PDF 文件,但每当我尝试读取该文件时,它都会引发异常:"Incorrect file format"。任何人都可以 help/guide 告诉我如何阅读此表单中的字段。

下面是我尝试使用的代码:

protected void Page_Load(object sender, EventArgs e)
    {
        string pdftype = Request.ContentType;
        int pdfocument = Request.ContentLength;
        try
        {
            byte[] pdf = new byte[pdfocument];
            Stream stream = new MemoryStream(pdf);
            Aspose.Pdf.Facades.Form form = new Aspose.Pdf.Facades.Form(stream);

         //   HttpContext.Request.InputStream.Read(pdf, 0, pdfocument);
            Document doc = new Document(stream);


        }
        catch (Exception ex)
        {
        } 

    }

我使用 HTML 导出格式而不是 FDF 格式解决了问题,并使用表单集合读取值。