PNG transparency in InfoPath

  • Thread starter Terry Thibodeau
  • Start date
T

Terry Thibodeau

As you can modify the HTML output by an InfoPath view's .xsl template, I
thought I might be able to use the AlphaImageLoader filter to display png
images with transparency (as they don't render properly by simply inserting
the png image).

After thinking about it, it makes sense that this filter can't be used
probably due to security restrictions around using the filter located in an
untrusted domain.

Is there any way to get image transparencies working in InfoPath (please
don't say install IE 7.0 beta :) )?

Perhaps I could use managed code to manipulate the image??

Thanks in advance for the help.
 
R

RMack005

It's probably placing the unfiltered image on top of the filtered one. Try
using a transparent gif as the source for the IMG element and your png for
the source in the call to the filter. You can also try applying the image
and invoking the filter via css: http://koivi.com/ie-png-transparency/
 
T

Terry Thibodeau

Thanks.

I probably should have specified the implementation that I was using:

I inserted a 1 x 1 pixel, transparent .gif into the InfoPath form so it
would be included into the package (.xsn). I also inserted the .png file.

I then modified the default view.xsl file to reference the images like so:

<img style="FILTER:
progid:DXImageTransform.Microsoft.AlphaImageLoader(src='BD55AF9E.png',
scalingMethod='image'); WIDTH: 60px; HEIGHT: 48px" src="B55DBEE5.gif"/>

All I get is a 60px by 48px blank image (obviously, the transparent .gif).

I tried changing the size of the blank.gif to 10px by 10px and put a solid
1px black border on the image. If the filter was working properly, I should
see a small 10x10 square with a black outline and the png image behind it.

I put the above code (with the 10px size change) into a testpng.html file in
the InfoPath project's working directory and opened in IE. Now, I got an
"Active Content" warning and had to stop the content block. When I unblocked
the content, I saw what was expected, a 10x10 square with the png image
behind it.

I'm thinking this is exactly why it isn't working in InfoPath...security
boundaries.

Now, the question is, can I circumvent this using managed code?
 
T

Terry Thibodeau

Yes, I've come to that realization as well. It sure would be nice if
Microsoft took the png rendering from IE 7 and put it into InfoPath! HINT
HINT HINT!

For now, I just created a jpg with the background color set to the same as
the header where I was placing it and created another with a white background
for the print view. It's a hack, but works...

Greg Collins said:
It is my experience that filters/image transofrms do not work in InfoPath.

--
Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com



Thanks.

I probably should have specified the implementation that I was using:

I inserted a 1 x 1 pixel, transparent .gif into the InfoPath form so it
would be included into the package (.xsn). I also inserted the .png file.

I then modified the default view.xsl file to reference the images like so:

<img style="FILTER:
progid:DXImageTransform.Microsoft.AlphaImageLoader(src='BD55AF9E.png',
scalingMethod='image'); WIDTH: 60px; HEIGHT: 48px" src="B55DBEE5.gif"/>

All I get is a 60px by 48px blank image (obviously, the transparent ..gif).

I tried changing the size of the blank.gif to 10px by 10px and put a solid
1px black border on the image. If the filter was working properly, I should
see a small 10x10 square with a black outline and the png image behind it.

I put the above code (with the 10px size change) into a testpng.html file in
the InfoPath project's working directory and opened in IE. Now, I got an
"Active Content" warning and had to stop the content block. When I unblocked
the content, I saw what was expected, a 10x10 square with the png image
behind it.

I'm thinking this is exactly why it isn't working in InfoPath...security
boundaries.

Now, the question is, can I circumvent this using managed code?

RMack005 said:
It's probably placing the unfiltered image on top of the filtered one. Try
using a transparent gif as the source for the IMG element and your png for
the source in the call to the filter. You can also try applying the image
and invoking the filter via css: http://koivi.com/ie-png-transparency/
 
T

Terry Thibodeau

I guess I didn't have my MSDN subscriber alias set up (which would explain
why I received no responses on this issue from support).

Now that I have set this up, I assume that I will receive a response within
2 business days. Is this the case?

Terry Thibodeau said:
Yes, I've come to that realization as well. It sure would be nice if
Microsoft took the png rendering from IE 7 and put it into InfoPath! HINT
HINT HINT!

For now, I just created a jpg with the background color set to the same as
the header where I was placing it and created another with a white background
for the print view. It's a hack, but works...

Greg Collins said:
It is my experience that filters/image transofrms do not work in InfoPath.

--
Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com



Thanks.

I probably should have specified the implementation that I was using:

I inserted a 1 x 1 pixel, transparent .gif into the InfoPath form so it
would be included into the package (.xsn). I also inserted the .png file.

I then modified the default view.xsl file to reference the images like so:

<img style="FILTER:
progid:DXImageTransform.Microsoft.AlphaImageLoader(src='BD55AF9E.png',
scalingMethod='image'); WIDTH: 60px; HEIGHT: 48px" src="B55DBEE5.gif"/>

All I get is a 60px by 48px blank image (obviously, the transparent ..gif).

I tried changing the size of the blank.gif to 10px by 10px and put a solid
1px black border on the image. If the filter was working properly, I should
see a small 10x10 square with a black outline and the png image behind it.

I put the above code (with the 10px size change) into a testpng.html file in
the InfoPath project's working directory and opened in IE. Now, I got an
"Active Content" warning and had to stop the content block. When I unblocked
the content, I saw what was expected, a 10x10 square with the png image
behind it.

I'm thinking this is exactly why it isn't working in InfoPath...security
boundaries.

Now, the question is, can I circumvent this using managed code?

RMack005 said:
It's probably placing the unfiltered image on top of the filtered one. Try
using a transparent gif as the source for the IMG element and your png for
the source in the call to the filter. You can also try applying the image
and invoking the filter via css: http://koivi.com/ie-png-transparency/

:

As you can modify the HTML output by an InfoPath view's .xsl template, I
thought I might be able to use the AlphaImageLoader filter to display png
images with transparency (as they don't render properly by simply inserting
the png image).

After thinking about it, it makes sense that this filter can't be used
probably due to security restrictions around using the filter located in an
untrusted domain.

Is there any way to get image transparencies working in InfoPath (please
don't say install IE 7.0 beta :) )?

Perhaps I could use managed code to manipulate the image??

Thanks in advance for the help.
 
Top