我有一个使用 Adobe Acrobat DC 创建的可填写 PDF 表单,我想将此表单提交到 URL:http://localhost:49168/WebForm1.aspx。
我正在使用 Aspose.Pdf 库读取我的代码中的 PDF 文件,但是每当我尝试读取该文件时,它都会引发异常:“文件格式不正确”。任何人都可以帮助/指导我如何阅读此表格中的字段。
以下是我尝试使用的代码:
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)
{
}
}