Question

Fanout to multiple pdf's

  • 19 December 2016
  • 10 replies
  • 30 views

Badge

I have two inputs that I'm trying to write to multiple pdfs, one is constant and the other changes with a fanout. But I can't get it to put both inputs on one pdf. I'll try and explain with an example:

Input one is a roads dataset, input two is a neighborhood's dataset. I'm using a dataset fanout to produce a pdf for every neighborhood and want the roads to also be on each pdf. I can't seem to combine the two, at the moment I get a pdf for each neighborhood and a separate one for the roads. What am I missing?

I'm new to FME, so apologies if this is something really simple that I've missed!

Andy


10 replies

Badge

Try using the StringConcatenator to make a new attribute which is "Road" fme basename"and Neighbourhood "fmebasename" and then fanout on that attribute.

Userlevel 1
Badge +21

Does the same road data need to appear on more than one pdf? i.e. does Road 1 need to be on Neighbourhood A and Neighbourhood B map? If this is the case you need to figure out a way to make 2 copies of Road 1 - one referencing Neighbourhood A and one referencing Neighbourhood B

e.g. you could use a spatial relator to create a list of neighbourhoods a road should be related to and then explode the list so you have multiple copies of roads and the Neighbourhood they relate to which you can then use for your fanout.

Badge +16

Another option will be using the SpatialFilter to create the relationship between road en neighborhood, hopefully both datasets will end up with the same value to be used in the fanout.

Badge

Thank you all for your help! Yes, to confirm I need both the neighborhood layer and road layer on every pdf. I've adjusted one of the images from the help files to try and describe it better:

Sorry if my terminology is wrong but I'm taking the two layers, putting each through a PDFStyler each and then both into a PDFPageFormatter. The following image shows a simplified version of what I've done. In my actual one I've also got titles on the pdf that take the neighborhood names too.

Would a SpatialFilter or relator achieve this?

Many thanks!

 

Userlevel 1
Badge +21

Yes, you basically need a copy the road layer for each neigbourhood, and there are a number of different ways to do this. Because you don't want just the roads that fall within the neighbourhood the spatial relator is probably not the best one to use here.

Userlevel 1
Badge +21

One way to do it, build a list of all neighbourhood names, merge the list with the featuremerger then explode the list. This will give you a copy of every road feature with the correct fanout attribute for each neighbourhood

e.g.

Badge

Amazing, thanks egomm! In case anyone else gets stuck on this, the above worked for me with the addition of also linking the neighborhoods to the PDFPageFormatter too as ListBuilder doesn't output geometry. As per below:

Thanks for all your help!

Badge +1

Hi, If I want to convert 1000 jpeg and fanout to PDF, how can I do that and adjust so that PDF page size matches the jpeg picture size without doing this manually? If I use PDFpageformatter it will only adjust to one specific page size.

Badge +2

Hi, If I want to convert 1000 jpeg and fanout to PDF, how can I do that and adjust so that PDF page size matches the jpeg picture size without doing this manually? If I use PDFpageformatter it will only adjust to one specific page size.

Hi @souryananassera,

Interesting one, not sure if this is possible with the PDFPageFormatter as it doesn't look like the Page Width and Page Height parameters accept attribute values as an input.

However, it looks like the Page Size (points) parameter accepts attributes as values so you might have some success by specifying the page size in PostScript points using the format <width> <height>. So if you extract the jpeg dimensions then create an attribute containing with the dimensions that should work. I have attached an example below that might help you get started with this.

Output in Adobe Reader:

Hope that helps

PDF_Size.fmw

Badge +2

Hi @souryananassera,

Interesting one, not sure if this is possible with the PDFPageFormatter as it doesn't look like the Page Width and Page Height parameters accept attribute values as an input.

However, it looks like the Page Size (points) parameter accepts attributes as values so you might have some success by specifying the page size in PostScript points using the format <width> <height>. So if you extract the jpeg dimensions then create an attribute containing with the dimensions that should work. I have attached an example below that might help you get started with this.

Output in Adobe Reader:

Hope that helps

PDF_Size.fmw

The PDFMultiPageSet transformer on the FME Hub might do the trick as well! https://hub.safe.com/publishers/corrado/transformers/pdfmultipageset

Reply