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

ConvertDocToPDF

Hi everyone,

Here is my problem. When I try to create a new WordDocument, an exception "System.ArgumentOutOfRangeException : Non-negative number required" occurs.

Here is my code :

Public Function ConvertDocToPDF(ByVal v_strDocFileName As String, ByVal v_strPassword As String, ByVal v_strPDFFileName As String) As Boolean
Dim blnReturn As Boolean = False
Dim objConverter As DocToPDFConverter = Nothing
Dim objWordDocument As WordDocument = Nothing
Dim objPDFDocument As Pdf.PdfDocument = Nothing

Try
objWordDocument = New WordDocument(v_strDocFileName, v_strPassword)
objConverter = New DocToPDFConverter
objPDFDocument = objConverter.ConvertToPDF(objWordDocument)
objPDFDocument.Save(v_strPDFFileName)
blnReturn = True
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.ToString)
Throw ex
Finally
If Not IsNothing(objWordDocument) Then objWordDocument.Close()
If Not IsNothing(objPDFDocument) Then objPDFDocument.Close()
If Not IsNothing(objConverter) Then objConverter.Dispose()
End Try

Return blnReturn
End Function

Can anybody help me...

Thanks in advance

Carl Davidson

2 Replies

BP Bhuvaneswari P Syncfusion Team June 20, 2009 05:52 AM UTC

Hi Carl.

Thank you for your interest in Syncfusion products.

Could you please provide your word document in which you want to convert to PDF document? This would be very helpful for us to reproduce and investigate the issue further.

Best Regards,
Bhuvana


MA Mitch Arias December 19, 2009 04:38 PM UTC

Carl,

Could you please tell me what assemblies you are using in order to get to the DocToPDFConverter class? I cannot find it anywhere.

Thanks,

Loader.
Live Chat Icon For mobile
Up arrow icon