We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

NullReference when execute ConvertToPdf(WordDocument)

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?


2 Replies

ER Ernane Ribas December 15, 2015 01:08 PM UTC

More Information

Exception throw:
An exception of type 'System.NullReferenceException' occurred in Syncfusion.DocIO.Base.dll but was not handled in user code


SV Sarathkumar V Syncfusion Team December 16, 2015 08:47 AM UTC

Hi Ernane,

Thank you for using Syncfusion product.

We have created a support incident for the reported Null reference exception issue in Word to PDF conversion under your account.
Please log on to our support website to check for further updates

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents


Regards,
Sarath


Loader.
Live Chat Icon For mobile
Up arrow icon