We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Error converting htm to PDF or Tiff images

Getting error when converting htm to pdf and same error when converting same htm to tif

Public Function Convert2Tiff(ByVal In_HtmFilename As String, ByVal OutputFp As String) As Boolean
	Try
		Using document As HTMLDocument = New HTMLDocument(In_HtmFilename)
			' Initialize ImageSaveOptions 
			Dim options = New Aspose.Html.Saving.ImageSaveOptions(Aspose.Html.Rendering.Image.ImageFormat.Tiff)
			options.BackgroundColor = System.Drawing.Color.White
			' Convert HTML to TIFF
			Aspose.Html.Converters.Converter.ConvertHTML(document, options, OutputFp)
		End Using

		Convert2Tiff = True
	Catch ex As Exception
		MsgBox(String.Format("Error Converting to tiff : {0}", ex.Message), MsgBoxStyle.OkOnly, "Error")
		Convert2Tiff = False
	End Try
End Function
Public Function Convert2pdf(ByVal In_HtmFilename As String, ByVal OutputFp As String) As Boolean
	Convert2pdf = False
	Try
		Using document As HTMLDocument = New HTMLDocument(In_HtmFilename)
			' Initialize PdfSaveOptions 
			Dim options = New Aspose.Html.Saving.PdfSaveOptions()
			options.BackgroundColor = System.Drawing.Color.White
			' Convert HTML to PDF
			Aspose.Html.Converters.Converter.ConvertHTML(document, options, OutputFp)
		End Using

		Convert2pdf = True
	Catch ex As Exception
		MsgBox(String.Format("Error Converting to PDF : {0}", ex.Message), MsgBoxStyle.OkOnly, "Error")
		Convert2pdf = False
	End Try
End Function

@elumicor

Would you please share the error details along with the sample HTML file for our reference? We will test the scenario in our environment and address it accordingly.

TestFile.zip (8.1 KB)
Attached is my test file. I have several like this one.

@elumicor

We were able to replicate the issue in our environment while using 21.8 version of the API. Therefore, we have logged it as HTMLNET-3329 in our issue tracking system. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.