I have a fillable PDF form created using Adobe Acrobat DC and I want to submit this form to a URL: http://localhost:49168/WebForm1.aspx.
I am using Aspose.Pdf library to read the PDF file on my code but whenever I am trying to read the file it throws an exception: "Incorrect file format". Can anybody help/guide me how to read the fields from this form.
Below is code I am trying to use:
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)
{
}
}
I resolved the issue with using HTML export format instead of FDF format and read the values using Form collection.