I think you should do this with PDFStyler. There you can set opacity for lines and fillings.
I'm using a WMS source and saving the result as png (I'm dowloading several images). I read the images (RasterReader) and do some offsetting and scaling. Since they are images I can't set opacity seperately for my lines and the background using PDFStyler. It makes the whole image transparent. I was hoping to be able to set the white background in the raster image transparent (png format) and then write that as a layer in a PDF (conserving the opacity). Any ideas?
There's an exercise in our FME Desktop basic training that I think will help. Check out step 10.
Basically you need to add a RasterExpressionEvaluator transformer. The expressions are:
red8:Â A 0]
green8:Â Ae1]
blue8:Â A/2]
alpha8: if (Al2]==255,0,255)
That means that the red, green, blue aspects don't change. But, if the blue aspect is 255 then assume it is white and assign an alpha value to make it transparent.
Technically you ought to test for Ak0]==255 AND Aa1]==255 AND Ae2]==255 to be sure it is white. I am using a shortcut in the training for simplicity's sake.Â
And, of course, if you don't have an Alpha band you'll need to add one (RasterBandAdder)
Thank you for your ideas, however I can't make this to work writing to a pdf...
In UniveraslViewer the layers show correctly, where the colour white in layer commune is transparent and layer raster in shown underneath it (background map). When I write to pdf each layer has to be a single layer in the pdf that I can turn on/turn off. The layer commune will unfortunately have a white background...
Did you ever make it work? I tried numerous workarounds and I can't make it appear transparent on the final PDF.