Hi,
I have to convert an existing HTML page with text, table and images.
The .pdf file generete is ok but there isn't the images, any ideas?
Thanks
Image with tempFilePath
Re: Image with tempFilePath
Support · Mar 6, 2013Hello,
Can you please send over the following details to our [^a|mailto:support@cete.com|opennewwindow|support ^] team so that they can look into it further?
1.Full HTML which you are using for conversion.
2.Code used to convert HTML to PDF.
3.Output PDF document.
Thanks,
ceTe Software Support Team.
Re: Image with tempFilePath
Forum member · Mar 14, 2013I am having this same issue. The image on the page does not get converted or brought over into the PDF. It shows up as a red X.
Re: Image with tempFilePath
Support · Mar 14, 2013Hello,
Please email the following details to us at [^a|mailto:support@cete.com|opennewwindow|support@cete.com^]. We would need this information to look into this issue.
1. HTML that is being converted.
2. Code used to convert HTML to PDF.
3. Output PDF document.
Thanks,
ceTe Software Support Team.
Re: Image with tempFilePath
Forum member · Mar 27, 2013I resolved the problem with this "replace" to modify the reference of the images.
here the code...
Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
If (ConvertToPDF) Then
Dim textWriter As System.IO.TextWriter = New System.IO.StringWriter()
Dim hTextWriter As System.Web.UI.HtmlTextWriter = New System.Web.UI.HtmlTextWriter(textWriter)
MyBase.Render(hTextWriter)
Dim htmlContent As String = textWriter.ToString()
htmlContent = htmlContent.Replace("../../images/", HttpRuntime.AppDomainAppPath + "Images\")
Dim options As HtmlConversionOptions = New HtmlConversionOptions(555, 800, 15)
Converter.ConvertHtmlStringToWeb(htmlContent, options)
Else
MyBase.Render(writer)
End If
End Sub
Re: Image with tempFilePath
Support · Mar 27, 2013Hello,
Looking at the code posted, if you are using ConvertHtmlStringToWeb or ConvertHtmlString methods the file path to the resources (images, css etc) in the html should be absolute paths. If relative paths are used the above conversion methods will not be able to able to fetch the resources.
Thanks,
ceTe Software Support Team.