Unknown attribute in HeaderFooter element. The attribute name is DistanceFromEdge

I'm using Aspose.Word to populate some form merge fields and then Aspose.PDF to convert it to PDF. I am getting the error message "Unknown attribute in HeaderFooter element. The attribute name is DistanceFromEdge." on the pdf.BindXML call. I have attached the Word document that I am using as the source. What needs to be done to fix this error? Thank you.

Aaron Buhr

Fidelity Information Services

Hi,

Thank you for considering Aspose.

I have checked with latest version of Aspose.Words(4.2.6.0) and Aspose.Pdf(3.5.1.0) and I am unable to reproduce the error. Please make sure you are using the latest version of both the products.

Thanks.

Adeel Ahmad
Support Developer
Aspose Changsha Team

I wasn’t having the problem with the previous versions of Aspose.Word and Aspose.PDF. I downloaded the newest versions of the two today and installed them, and that’s when the problem began. Did you use my attachment? Here is the code that produces the error:

Aspose.Words.Document doc = new Aspose.Words.Document(tb_InputFileName.Text);

foreach (Aspose.Words.FormField field in doc.Sections[0].Range.FormFields) {
LogLine(field.Name);
if (field.Type.ToString() == "FieldFormCheckBox")
{
field.Result = "1";
}
else {
if (_fieldVals.ContainsKey(field.Name.ToUpper()))
field.Result = _fieldVals[field.Name.ToUpper()];
else
field.Result = field.Name.ToUpper();
}
}

MemoryStream ms = new MemoryStream();
XmlDocument xml = new XmlDocument();

doc.Save(ms, Aspose.Words.SaveFormat.AsposePdf);

ms.Position = 0;
xml.Load(ms);
Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
pdf.BindXML(xml, null);
ms.Close();
System.IO.MemoryStream pdfMS = new MemoryStream();
pdf.Save(tb_OutputFileName.Text);

Hi,

I wonder why I can’t reproduce this error. I have checked with the same code and the documents you have sent. I have checked with .NET 2.0 are you using the same .NET version and also please try to add the references again. For your reference I am attaching the resultant Pdf. Still if you get problems then try to create a new project and then test that issue. Please let me knew your test results.

Thanks.

Adeel Ahmad
Support Developer
Aspose Changsha Team