Skip to main content
Question

Writing transparent layers in PDF


Forum|alt.badge.img

Hi,

I read several WMS layers (from the same source) and each layer is written to a single layer in a pdf. For example, I read a WMS background map and write it as one layer, then I read a WMS line network and write it as one layer and this is where I have problems. In my line network layer, I want everything to be transparent, except of course the network itself. Can I create pdf with layers that are transparent for some values (white, no data...) by using a WMS source ? If not, is this a limitation of FME pdf writer or the pdf format itself ?

I can't use the workaround by "pre-generating" the layers before writing them since the pdf would be huge.

By the way, I am using FME 2013...

Many thanks

Rickard

6 replies

Forum|alt.badge.img
  • April 25, 2016

I think you should do this with PDFStyler. There you can set opacity for lines and fillings.


Forum|alt.badge.img
  • Author
  • April 26, 2016

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?


Forum|alt.badge.img
  • April 26, 2016

mark2atsafe
Safer
Forum|alt.badge.img+43
  • Safer
  • April 27, 2016

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: A[1]
blue8: A[2]
alpha8: if (A[2]==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 A[0]==255 AND A[1]==255 AND A[2]==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)


Forum|alt.badge.img
  • Author
  • April 28, 2016

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...


mathiku
Contributor
Forum|alt.badge.img+7
  • Contributor
  • June 17, 2021

Did you ever make it work? I tried numerous workarounds and I can't make it appear transparent on the final PDF.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings