When i try convert my docx in pdf file i receive the exception NullReferenceException.
I'm importing the follow dll:
version: 13.3450.0.7
Imports Syncfusion.OfficeChart
Imports Syncfusion.DocIO
Imports Syncfusion.DocIO.DLS
Imports Syncfusion.DocToPDFConverter
Imports Syncfusion.Pdf
Imports Syncfusion.OfficeChartToImageConverter
Imports Syncfusion.Core
And my code using:
Try
Dim wordDocument As New WordDocument(filename, FormatType.Docx)
'Creates an instance of the DocToPDFConverter
Dim converter As New DocToPDFConverter()
'Converts Word document into PDF document
Dim pdfDocument As PdfDocument = converter.ConvertToPDF(wordDocument)
'Saves the PDF file
pdfDocument.Save(filenamePdf)
'Closes the instance of document objects
pdfDocument.Close(True)
wordDocument.Close()
Catch ex As Exception
End Try
The variable "filename" is a full path for my docx. The variable "filenamePdf" is a full path for my pdf file.
Sample:
filename = "C:\tempFile\file.docx"
filenamePdf = "C:\tempFile\file.pdf"
What's I doing wrong??
Any help me?