When converting the attached Word document to PDF using the following code I get an extra page on the resultant PDF file. I am using Words 5.2.2, PDF 3.7. Can you tell me what can be done to get rid of the extra page?
Document doc = new Document(wordDocTextBox.Text);
DataSet testDataSet = new DataSet();
DataTable OtherText = new DataTable("EventParameters");
OtherText.Columns.Add("SortName");
OtherText.Columns.Add("SSNLast4");
OtherText.Columns.Add("HireDate");
OtherText.Columns.Add("BirthDate");
DataRow row = OtherText.NewRow();
row["SortName"] = "Mr. Jones (and me)";
row["SSNLast4"] = "1234";
row["HireDate"] = "1/1/2000";
row["BirthDate"] = "1/1/2000";
OtherText.Rows.Add(row);
testDataSet.Tables.Add(OtherText);
doc.MailMerge.ExecuteWithRegions(testDataSet);
MemoryStream mergedStream = new MemoryStream();
// save to special pdf/xml format
doc.Save(mergedStream, SaveFormat.AsposePdf);
//Seek to the beginning so it can be read by XmlDocument.
mergedStream.Seek(0, SeekOrigin.Begin);
//Load the document into an XmlDocument
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(mergedStream);
//Load the XML document into Aspose.Pdf
Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
//Make sure the images that were saved by Aspose.Words into Windows temporary
//folder are automatically deleted by Aspose.Pdf when they are no longer needed.
pdf.IsImagesInXmlDeleteNeeded = true;
pdf.BindXML(xmlDoc, null);
//*** Aspose.Pdf font cache, see comments below.
pdf.IsTruetypeFontMapCached = false;
//If you convert to PDF multiple files in your application,
//uncomment the following lines to improve the speed of conversion.
//pdf.IsTruetypeFontMapCached = true;
//pdf.TruetypeFontMapPath =
//Now produce the PDF file.
pdf.Save(Path.ChangeExtension(wordDocTextBox.Text, ".pdf"));