What I’m trying to do is convert word 2003 document. During conversion
Save method throws an exception. Here is the code snippet:
Dim doc As Aspose.Word.Document
docContent.Position = 0
doc = New Aspose.Word.Document(docContent)
doc.Save(docContentXml, Aspose.Word.SaveFormat.FormatAsposePdf)
Since Aspose.Word currently does not use XML transformations, the problem should lie somewhere in Aspose.Pdf or in your code. Please check the stack trace.
I’ve downloaded the latest versions of Aspose.Word and Aspose.Pdf.
Here is the code snippet:
Dim license As Aspose.Word.License = New Aspose.Word.License()
license.SetLicense("Aspose.Custom.lic.xml")
Dim doc As Aspose.Word.Document
docContent.Position = 0
doc = New Aspose.Word.Document(docContent)
doc.Save(docContentXml, Aspose.Word.SaveFormat.FormatAsposePdf)
TransformXmlToPdf(docContentXml, outputPdf)
The first line throws exception: “File or assembly name System, or one of its dependencies, was not found.” (see attached picture)
What version of .NET Framework are you using? If it’s 1.0, please install 1.1 or read this programmers guide topic to learn how to target Aspose.Word to .NET Framework 1.0:
Thanks for quick reply. I’m using framework version 1.0. I’ve done as you suggested - changed machine.config (unfortunately our program isn’t using application config file). Now pdf.BindXML(xml, Nothing) line (see snippet below) throws an exception: “Method not found: Void System.Xml.Xsl.XslTransform.Transform(System.Xml.XPath.IXPathNavigable, System.Xml.Xsl.XsltArgumentList, System.IO.Stream, System.Xml.XmlResolver).”
Dim lic As Aspose.Pdf.License = New Aspose.Pdf.License()
lic.SetLicense("Aspose.Custom.lic.xml")
Dim pdf As Aspose.Pdf.Pdf = New Aspose.Pdf.Pdf()
Dim xml As New System.Xml.XmlDocument()
inputXml.Position = 0
xml.Load(inputXml)
pdf.BindXML(xml, Nothing)
pdf.IsImagesInXmlDeleteNeeded = True
pdf.Save(outputPdf)
It seems to me that this is the same problem with framework 1.0. How can be this problem eliminated?
Aspose.Pdf needs .Net framework 1.1. Please update to .Net framework 1.1. If you don’t want to update, I can provide you a special version that can be run in .Net framework 1.0.
So are you sure that if you use the attached dll, InvalidOperationException is thrown exactly on the line you specified? The point is that this line doesn’t involve Aspose.Pdf so throwing should not depend on what Aspose.Pdf.dll you use and if you use it at all…
We tested attached Aspose.Pdf.dll on two documents.
With next simple document Doc1.doc it’s work.
But for Doc2.doc isn’t work.
Raise Exception with message: Stack empty.
There is no special Aspose.Word version for .NET Framework 1.0, and moreover for a particular version of MS Word. Please just download the latest version of Aspose.Word from our download page and target to .NET Framework 1.0 as described in that Wiki topic (see the link in one of above posts).