Free Support Forum - aspose.com

Conversion of word file to pdf failing

Hi,
I am using registered version of Aspose Word(ver 9.0.0.0) for .Net . Conversion for attached word file to pdf is failing. This is quite urgent issue for me. Can you please provide the solution with ver9.0.0.0 ? Is this fixed with latest version? This issue is extremely urgent so please do the needful ASAP.


Following is the code I used:

public static void ConvertWordToPdf(string sourceFilePath, string destinationFilePath)
{
Aspose.Words.Document doc = new Aspose.Words.Document(sourceFilePath);
doc.SaveToPdf(destinationFilePath);
}

Following is the exception I am getting:

With C:\temp\203\XXXXXX++4.1.2.2+Adviesaanvraag+Aecum+28052008.versieFBA.doc I am getting following exception:
System.ArgumentException was caught
Message="The newChild is an ancestor of this node."
Source="Aspose.Words"
StackTrace:
at Aspose.Words.CompositeNode.?(Node ?, Node ?, Boolean ?)
at Aspose.Words.CompositeNode.InsertAfter(Node newChild, Node refChild)
at Aspose.Words.CompositeNode.AppendChild(Node newChild)
at ?.?.?(Paragraph ?)
at ?.?.?(Paragraph ?)
at ?.?.VisitParagraphStart(Paragraph paragraph)
at Aspose.Words.Paragraph.Accept(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.?(DocumentVisitor ?)
at Aspose.Words.Tables.Cell.Accept(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.?(DocumentVisitor ?)
at Aspose.Words.Tables.Row.Accept(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.?(DocumentVisitor ?)
at Aspose.Words.Tables.Table.Accept(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.?(DocumentVisitor ?)
at Aspose.Words.Drawing.Shape.Accept(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.?(DocumentVisitor ?)
at Aspose.Words.Paragraph.Accept(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.?(DocumentVisitor ?)
at Aspose.Words.HeaderFooter.Accept(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.?(DocumentVisitor ?)
at Aspose.Words.Section.Accept(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.?(DocumentVisitor ?)
at Aspose.Words.Document.Accept(DocumentVisitor visitor)
at ?.?.?(Document ?, ? ?)
at ?.?.?(Document ?, ? ?)
at Aspose.Words.Document.UpdatePageLayout()
at Aspose.Words.Document.get_?()
at Aspose.Words.Document.get_PageCount()
at Aspose.Words.Document.SaveToPdf(String fileName)
at Intralinks.Common.Utilities.AsposeConverter.ConvertWordToPdf(String sourceFilePath, String destinationFilePath) in C:\WSB\Trunk\IntralinksSolution\CommonUtilities\AsposeConverter.cs:line 39
at Intralinks.Common.Utilities.CommonUtilities.ConvertOfficeDocsToPDF(String sourceFile, String destinationFolder, Boolean useOriginalFileName) in C:\WSB\Trunk\IntralinksSolution\CommonUtilities\CommonUtilities.cs:line 1357
InnerException:


Thanks
Viral

Hi Viral,

I think you should try using Aspose.Words for .NET 10.5.0. The documents seem to be properly converted into PDF format. See the attachments.