Hi, I have recently started using Generator version 3 and have migrated the following code from a ReportWriter page that worked correctly:
Dim image, objImage
Set image = m_objPage.AddImage("", 425, 0, 21)
Set image.OnPreDraw = GetRef("SetImagePath")
Function SetImagePath(objImage)
if objReport.RecordSet("DaysOD") > 0 Then
objImage.FileName = Server.MapPath("icon_No.png")
else
objImage.FileName = Server.MapPath("icon_Yes.png")
End If
End Function
I have moved the images to the new folder, but now receive the error "Image file not found."
I'm assuming this is because the page is trying to add an image from the location "", which obviously doesn't exist. Can you tell me how to fix this please?
Thank you.
Dynamic Images
Re: Dynamic Images
Support · Sep 15, 2006Hello,
The reason it is not finding the image is because it is taking "" as the path to the image file. In v3.0 for COM/ActiveX there is no OnPreDraw event off the Image object and therefore it is not making a call to the function SetImagePath which will set the path for the image. You will have to change your logic a bit in order to set the image path dynamically.
Thanks,
ceTe Software Support Team
Re: Dynamic Images
Forum member · Sep 15, 2006Any chance of an example?
Thanks
Re: Dynamic Images
Support · Sep 15, 2006Hello,
We do not have any working example that would do exactly similar to what you are looking for. But here is the basic code logic that should likely work:
If MyRecordSet.Fields( 1 ) > 0 Then
MyPage.AddImage Server.MapPath( "icon_NO.png" ), 425, 0, 21
Else
MyPage.AddImage Server.MapPath( "icon_YES.png" ), 425, 0, 21
End If
Thanks,
ceTe Software Support Team
Re: Dynamic Images
Forum member · Sep 15, 2006Thank you, that works perfectly. However, when i try to use gifs I receive the error message "Image file is not a recognized type.", but I was told on the reportWriter forum that gifs were in generator version 3. Is this not the case? If gifs are not supported, can you tell me which image types are, in particular any that allow a transparent background?
Thanks
Re: Dynamic Images
Support · Sep 15, 2006Hello,
DynamicPDF Generator for COM/ActiveX v3.0 does have support for GIF images. Make sure that the image you are using is valid GIF image. If you continue experiencing the problem, please send over the GIF image to our [^a|mailto:support@cete.com|Support Team^] and they can take a look at it.
Thanks,
ceTe Software Support Team