Question

Attribute data to pdf


Dear community!

First of all I've to say that I'm very new in the world of FME.

I have the following problem with the conversion from a simple 2D point feature to a non-spatial pdf. I'm familiar with the transformers (PDFStyler, PDFPageFormatter) and the Adobe Geospatial PDF File - Writer which I need for my pdf output. But I've no idea how to extract the information (Atttributes) of the points and write it in a table or list (in an ordered way) in a PDF. My problem is that the attributes are distributed spatially (according to their actual location in the map) across the PDF output after the LabelPointReplacer.

thx for your help


6 replies

Badge +3

There Is a table adder in the store, though its very.. limited.

You can create insertion points spaced equal tot the amount of the attribute(s) and records.

Statistics calculator, counter, bounding box creator, attribute exploder and list operations are very useful for building the table.

Badge +2

Hi @schlofferc. Adding table to PDF is indeed not an easy task. There are several method you might want to explore. With all of the ideas below, you can pre-sort the features, using a Sorter transformer, to control the order of the table/list generated:

  1. As gio mentioned, the TableAdder is a transformer you can try. Although it could be challenging to produce a nice looking table if you have a lot of columns. You can access it by simply start typing TableAdder on the main window in Workbench (we call it workbench canvas). There are some usage notes available here.
  2. It is also possible to create multiline text in the attribute of one feature, using the method suggested by Takashi here. Then, you can use PDFPageFormatter to insert this feature into the page layout. Inspiration of this idea came from this Community question.
  3. There are also two other custom transformers that sound promissing: HTML2PDFConverter, and ExcelToPDFWriter (can be added the same way as TableAdder). Both of these transformers require you to first produce the table with the desired look, in either HTML or Excel, which can be done using FME's FeatureWriter, and read back by FeatureReader. And they help embed some 3rd party technologies into FME to convert the table into PDF. Full discloser, I haven't had a chance to play with them personally. If you are feeling adventurous, I'd encourage you to give them a try.

We've had some other users raising the suggestion of improving table writing in PDF. It would be much appreciated if you can add your vote to this Idea, to express your interest in this enhancement.

Thank you for your help. I used the transformers you discribed and the "TableAdder" in comibination with the "PDFStyler". Everything works fine so long as I'm using a "tester" to reduce my input to one single feature, but if I want to use the whole data (disable the filter) the formatting of my pdf is mixed up - Every table moved over the sheet. Do you have any idea which settings can solve this problem? Maybe an example of the correct use of the "PDFPageFormatter" can help me.

Badge +2

Thank you for your help. I used the transformers you discribed and the "TableAdder" in comibination with the "PDFStyler". Everything works fine so long as I'm using a "tester" to reduce my input to one single feature, but if I want to use the whole data (disable the filter) the formatting of my pdf is mixed up - Every table moved over the sheet. Do you have any idea which settings can solve this problem? Maybe an example of the correct use of the "PDFPageFormatter" can help me.

Hi @schlofferc, thanks for the update. Can you share a screenshot of the output PDF and the workspace you used to create it? It may be hard for our community here to diagnose without a bit more detail.

 

One thing I've learned from my minimal experience with the TableAdder, is that some trial and error to adjust the parameter is always helpful.

 

Hi @XiaomengAtSafe!

 

I solved the problem with the mixed up tables by changing some transfomer settings and using a nonproportional font like Courier. But I still have a problem with the scale of the overview map in my pdf output. All works fine if I write one map after another by using a tester to the pdf but if I used the fan-out function the size and scale of the map is changing every run. Do you have any idea where I made the mistake or where I can change some setting?

For more details I added the part of my workbench where I defined the overview map with the necessary source and output.

thx and ciao

Badge +2

Hi @XiaomengAtSafe!

 

I solved the problem with the mixed up tables by changing some transfomer settings and using a nonproportional font like Courier. But I still have a problem with the scale of the overview map in my pdf output. All works fine if I write one map after another by using a tester to the pdf but if I used the fan-out function the size and scale of the map is changing every run. Do you have any idea where I made the mistake or where I can change some setting?

For more details I added the part of my workbench where I defined the overview map with the necessary source and output.

thx and ciao

Hi @schlofferc, good to hear you've solve the table challenge! Well done!

 

I figured out two changes that could make the result close to your desired outcome:

 

1. The page object placed in the PDFPageFormatter has a setting called "Maintain Aspect Ratio". I'd suggest that you change it to Yes. This will make sure the geometries don't appear distorted, when they are placed in the PDF.

 

2. The fanout result doesn't take up the extend of the data frame you drew in the PDFPageFormater, because the PDFPageFormatter is using the entire dataset to determine the placement of all the features, and fanout simply pick which features to write to which file.

 

To get around this issue, we need to somehow group the features by the attribute GSTID-, so each group will be used to fill the data frame, instead of the full dataset. Because the PDFPageFormatter doesn't have a Group by parameter, you can add one, by creating a custom transformer. And adding the Group by parameter by setting the Advanced parameter on Parallel Processing, and Parallel Process By parameters.

 

Below I attached the modified workspace for your reference.

 

20499-overviewmap-modified.fmw

 

Reply