System.NullReferenceException when converting of doc to pdf or html

Hello,

when converting a Word document using Aspose.Words 14.4 (the latest) I get the following stack trace:

L’exception System.NullReferenceException n’a pas été gérée
Message=La référence d’objet n’est pas définie à une instance d’un objet.
Source=Aspose.Words
StackTrace:
à . ( , ArrayList , , )
à . ( , , ArrayList , )
à . (Shape , , , )
à . ( ​ , , , Boolean )
à . ( ​ , , Boolean )
à . ( ​ , , Boolean )
à . ( ​ , , Boolean )
à . ( ​ , , Boolean )
à . ( ​ , Boolean )
à . ( , Boolean& )
à . ( , Boolean& )
à . ( )
à . ()
à . ()
à . ()
à . ()
à . ()
à . ()
à . ()
à . ( , Int32 )
à . ( )
à . ( )
à . ( , Int32 )
à . ( , Int32 , Boolean )
à . ()
à . ( , Int32 , Boolean , Boolean )
à ​ . ()
à ​ . ( ​ , Int32 )
à . ( ​ )
à . ( )
à . ( )
à . (Boolean )
à . (Boolean )
à . ()
à . (Document , )
à Aspose.Words.Document.UpdatePageLayout()
à Aspose.Words.Document. (Boolean )
à Aspose.Words.Document. ()
à Aspose.Words.Document.get_PageCount()
à . ( , )
à . ( )
à Aspose.Words.Document. (Stream , String , SaveOptions )
à Aspose.Words.Document.Save(String fileName, SaveOptions saveOptions)
à Aspose.Words.Document.Save(String fileName)
à ConsoleApplication1.Module1.Main() dans ConsoleApplication1\ConsoleApplication1\Module1.vb:ligne 13
à System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
à System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
à System.Threading.ThreadHelper.ThreadStart_Context(Object state)
à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
à System.Threading.ThreadHelper.ThreadStart()
InnerException:

My program :

Imports Aspose.Words
Imports Aspose.Words.Saving

Module Module1
Public Sub Main()
Dim lic As New License()
lic.SetLicense(“…..\Aspose.Words.lic”)
Dim doc As New Document(“…..\Dm_377.doc”)
doc.Save(“…..\out.pdf”)
End Sub
End Module

I have the same problem when I try to save the document to html.
I’m attaching the document.
My license is a temporary license (I haven’t the problem with the same program and document with the evaluation of aspose.words).
I use VB.NET 3.5.

Hi there,

Thanks for your inquiry.

I have tested the scenario and have managed to reproduce the same issues at my side. For the sake of correction, I have logged these problems in our issue tracking system as follow:

WORDSNET-10138 : System.NullReferenceException is thrown while converting Doc to Pdf
WORDSNET-10139 : System.NullReferenceException is thrown while converting Doc to HTML

I have linked this forum thread to the same issues and you will be notified via this forum thread once these issues are resolved.

We apologize for your inconvenience.

Hi,


Thanks for your response.
We are currently evaluating your product and please keep me informed about advancement.

Hi there,

Sure, we will update you via this forum thread once these issues are resolved. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.

The issues you have found earlier (filed as WORDSNET-10138;WORDSNET-10139) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Hi,


Your update fixes the basic problem, but in my complex program the problem have not been fixed.
However, the stack trace is different. I try to reproduce the problem with a simple program but i haven’t yet successful.
I give you the document after processing in my complex program, it’s interesting to remark that the simple conversion of this output document works (in a simple program which open and convert this document).
Following to this remark, i have try to implement the following code in my complex program but it not works.
'Create directory
Dim imagesDir As String = Path.Combine(chemin, “media”)
If Directory.Exists(imagesDir) Then
Directory.Delete(imagesDir, True)
End If
Directory.CreateDirectory(imagesDir)
'Options de sauvegarde
Dim htmlOptions As New HtmlSaveOptions(SaveFormat.Html)
htmlOptions.ExportTextInputFormFieldAsText = True
htmlOptions.ImagesFolder = imagesDir
Try
doc.Save(chemin & “D_” & iddoc & “.html”, htmlOptions)
Catch
'If error in conversion, try to convert with the native document generate.
Dim doc2 As New Document(chemin & “D_” & iddoc & doc.OriginalFileName().Substring(doc.OriginalFileName().LastIndexOf(".")))
doc2.Save(chemin & “D_” & iddoc & “.html”, htmlOptions)
End Try
And for PDF:
Dim pdfOptions As New PdfSaveOptions()
pdfOptions.ImageCompression = PdfImageCompression.Auto
pdfOptions.OpenHyperlinksInNewWindow = True
Try
doc.Save(chemin & “D_” & iddoc & “.pdf”, pdfOptions)
Catch
'If error in conversion, try to convert with the native document generate.
Dim doc2 As New Document(chemin & “D_” & iddoc & doc.OriginalFileName().Substring(doc.OriginalFileName().LastIndexOf(".")))
If doc2 IsNot Nothing Then
doc2.Save(chemin & “D_” & iddoc & “.pdf”, pdfOptions)
End If
End Try

I use the latest update of Aspose Words with temporary licence, and i get the following trace:
L’exception System.NullReferenceException n’a pas été gérée par le code utilisateur
Message=La référence d’objet n’est pas définie à une instance d’un objet.
Source=Aspose.Words
StackTrace:
à . ( , ArrayList , , )
à . ( , , ArrayList , )
à . (Shape , , , )
à . ( ? , , , Boolean )
à . ( ? , , Boolean )
à . ( ? , , Boolean )
à . ( ? , , Boolean )
à . ( ? , , Boolean )
à . ( ? , Boolean )
à . ( , Boolean& )
à . ( , Boolean& )
à . ( )
à . ()
à . ()
à . ()
à . ()
à . ()
à . ()
à . ()
à . ( , Int32 )
à . ( )
à . ( )
à . ( , Int32 )
à . ( , Int32 , Boolean )
à . ()
à . ( , Int32 , Boolean , Boolean )
à ? . ()
à ? . ( ? , Int32 )
à . ( ? )
à . ( )
à . ( )
à . (Boolean )
à . (Boolean )
à . ()
à . (Document , )
à Aspose.Words.Document.UpdatePageLayout()
à Aspose.Words.Document. (Boolean )
à . ( ? , )
à Aspose.Words.Rendering.ShapeRenderer…ctor(ShapeBase shape)
à . (ShapeBase )
à . (ShapeBase )
à .VisitGroupShapeStart(GroupShape )
à Aspose.Words.Drawing.GroupShape.r3ka8zscesabkstb24kjjv9sml9wq7pw (DocumentVisitor )
à Aspose.Words.CompositeNode.AcceptCore(DocumentVisitor visitor)
à Aspose.Words.Drawing.GroupShape.Accept(DocumentVisitor visitor)
à . ( , Paragraph )
à . (Paragraph )
à .VisitParagraphStart(Paragraph )
à Aspose.Words.Paragraph.r3ka8zscesabkstb24kjjv9sml9wq7pw (DocumentVisitor )
à Aspose.Words.CompositeNode.AcceptCore(DocumentVisitor visitor)
à Aspose.Words.Paragraph.Accept(DocumentVisitor visitor)
à Aspose.Words.CompositeNode.AcceptChildren(DocumentVisitor visitor)
à Aspose.Words.CompositeNode.AcceptCore(DocumentVisitor visitor)
à Aspose.Words.Body.Accept(DocumentVisitor visitor)
à . (Node )
à . (Section )
à . ()
à . ()
à . ()
à . ( )
à Aspose.Words.Document. (Stream , String , SaveOptions )
à Aspose.Words.Document.Save(String fileName, SaveOptions saveOptions)
à Qualnet.TraitementDocument.TraitementDoc.LancerTraitementGED(Document doc, Int32 idTransfo, Int32 iddoc, Int32 idthread, String idem, SqlPrepare requestPrepare) dans C:\SVN\Intranet_v4\branches\5.7\DLL\Qualnet.TraitementDocument\TraitementDoc.vb:ligne 177
à Qualnet.TraitementDocument.TraitementDoc.LancerTraitement(TypeTransfo typeTransfo, Int32 idTransfo, Int32 iddoc, String cheminFichier, SqlPrepare requestPrepare) dans C:\SVN\Intranet_v4\branches\5.7\DLL\Qualnet.TraitementDocument\TraitementDoc.vb:ligne 92
à intranet.RelanceTransformation.Page_Load(Object sender, EventArgs e) dans C:\SVN\Intranet_v4\branches\5.7\Doc\Parametrage\bao\RelanceTransformation.aspx.vb:ligne 31
à System.Web.UI.Control.OnLoad(EventArgs e)
à System.Web.UI.Control.LoadRecursive()
à System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException:

EDIT: I have found a solution to my problem, i unprotect the docucment before convert it.

Hi there,

Thanks for your inquiry. It is nice to hear from you that you have found the solution of your query.

While using the shared code, we are unable to reproduce the shared issue. Please create a standalone/runnable application (for example a Console Application Project) that demonstrates the code you used to reproduce this issue at our end. We will investigate the issue on our side and provide you more information.