Creating PDF Cartographic Output

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

  • FME 2023.0


This article will demonstrate how to read, style and sort feature types (layers), and how to set up a page layout for output to a PDF file. The attached example will generate 2D cartographic output, define how features can be drawn as a layer, and output map elements as individual layers. Our final cartographic output will be a map that includes:

  • A Map Title
  • A Signature block (i.e. creation information)
  • Background color imagery
  • A Bounding Box
  • Colored polygons representing voting divisions
  • Colored point features representing voting places
  • Labels for voting places

The attached workspace, geospatialpdf.fmwt, includes the transformers and workflow necessary to generate the PDF output you see below. You’ll notice that individual layers have been created in the PDF file that allows the user to turn off and on the various map elements. If you are having trouble with writing out Fonts in PDF, see the Troubleshooting Note

This example will create a map containing advanced voting locations in Divisions A and E that will be added to a PDF information poster to share with residents. 



Note that this video was recorded using FME Desktop 2016.0. The concepts demonstrated in this video are the same, the interface may be different. 


Step-by-step Instructions

1. Read in Data
In a blank workspace, add a JPEG 2000 reader to the canvas. Browse to the BackgroundMap.jp2 dataset, which you can download from the Files section of this article. The PDF writer will only write out JPEG images, if you are using a PNG, you will need to convert it to JPEG. 

Add a second reader to the canvas and select OGC GML (Geography Markup Language) as the format and ElectionVoting.gml as the dataset. 

In the Feature Types to Read dialog, select both VotingDivision and VotingPlaces. 

VotingDivisions is a polygon feature type that we will overlay over the JPEG background map raster. The VotingPlaces is a point feature that we will label to show advanced voting locations. 

2. Create Bounding Box
We want to create a bounding box around our background map. Add a BoundingBoxAccumulator transformer to the canvas and connect it to the JPEG 2000 reader feature type. We can accept the default parameters for this transformer. 

3. Create Labels
Next, let’s create labels on the voting locations. Add a Tester transformer to the canvas and connect it to the VotingPlaces reader feature type. 

Run the workspace with feature caching enabled. Then in the Tester parameters, set the Right Value to Division, the Operator to =, and then for Left Value, click on the drop-down and select Cached Values. In the Cached Values dialog, select ADV A and click OK. The Cached Values option is great for when you have lots of attribute values, or you are unsure of the spelling. 

Then on the next line, select OR as the Logic, then set the second test to Division = ADV E, and click OK. Or use the cached value method. 

If you are using an older version of FME, type ADV A as the right value for the first test. 



Next, add a LabelPointReplacer and connect it to the Passed output port on the Tester. In the parameters, set the Label to: 

Advanced Voting: @Value(Division)

Then set the Height to 0. The @Value(Division) will only label the two Divisions we tested for in the Tester. 


4. Create Order and Style Attributes
Since we want our background map in behind all of the other layers, we will need to set a layer order. To do this, we will use AttributeCreators. 

Add an AttributeCreator to the canvas and connect it to the JPEG2000 reader feature type. In the parameters, create a new attribute called _order and assign it the value of 0. Create a second attribute called fme_feature_type and assign it the value of BackgroundMap. The fme_feature_type value what the feature type name will be when the data is written, we will use this to fanout the dataset in the writer. 

We will use four more AttributeCreators to determine our layer order. Use the following parameters to set up the AttributeCreators:


  • Connected to: BoundingBoxAccumulator transformer
  • _order: 1
  • fme_feature_type: BoundingBox


  • Connected to: VotingDivisions reader feature type
  • _order: 2


  • Connected to: Tester Passed output port 
  • _order: 3 
  • pdf_point_width: 1.5

Note: The size of a point feature cannot be modified from within the parameters of the PDFStyler. However, this can be achieved by creating a new attribute called pdf_point_width’ in an AttributeCreator and changing its attribute value. 


  • Connected to: LabelPointReplacer transformer
  • _order: 4
  • fme_feature_type: Labels

AllAttributeCreators.png5. Create Title and Signature
We need to create two other components before we can start styling the PDF; the title and signature. Add a Creator to the canvas, in the parameters, click on the ellipsis for Geometry Object. In the Geometry Creator dialog, select Text as the Type, then enter in the following:

  • Text String: Vancouver Voting Divisions and Locations
  • Height: 10

Click OK, then rename the transformer to Title. 

Add another Creator and create a Text Geometry Object with the following parameters:

  • Text String: Created By: <Your name>
  • Height: 10
  • Transformer Name: Signature 

6. Style Features with PDFStyler Transformers
PDFStyler transformers are used for setting the appearance of the features that will appear in the final cartographic output. They can be used to style geometry (such as color, opacity, line styles) and text features (such as font size and style).

First, let’s style our Title and Signature layers. Add a PDFStyler to the canvas and connect it to the Title Creator. In the parameters, double-check that the color is set to Black (0,0,0), then change the font to Helvetica, Regular, Size 18. Click OK. 

Font Troubleshooting
*Note that due to operating system concentrates, only Helvetica and Symbol are available on macOS and Linux. If you choose a different font, you will receive a warning in the translation log and it will be written out in Helvetica. The best practice for writing out text to PDF is to always choose Helvetica.


Duplicate the PDFStyler (Ctrl + D) and connect it to the Signature Creator. In the parameters, change the Font Style to Italic and the Size to 14. 

We don’t need to style the background map, but we do need to change the line thickness for the bounding box. Add another PDFStyler to the canvas and connect it to the AttributeCreator connected to the BoundingBoxAccumulator. In the parameters, change the Fill Opacity to 0, the Line Width to 3, and click OK. 

Next, we will style the VotingDivisions. Add another PDFStyler to the canvas and connect it to the AttributeCreator connected to the VotingDivisions reader feature type. In the parameters, change the Color and Line Color to green (0,170,0). Then change the Fill Opacity to 0.5.

Now to style the Labels and points. Duplicate the PDFStyler connected to the Signature Creator, and then connect it to the AttributeCreator that is connected to the Tester. We can accept the default parameters, as we want our points to be black. 

Duplicate the Signature PDFStyler again, and then connect it to the AttributeCreator connected to the LabelPointReplacer. In the parameters, change the Fill Opacity to 1, and the Font Style to Regular, and click OK. 

7. Sort Drawing Order
Add a Sorter to the canvas and connect all the workflows that have AttributeCreators. There should be one connection directly from an AttributeCreator and four from PDFStylers. 

In the Sorter parameters, set it to _order, Numeric, Ascending. 


8. Set Up PDF Page
Now with all of the layers styled and sorted, we can design a PDF Page. Add a PDFPageFormatter to the canvas and connect the two PDFStylers from the Signature and Title Creators, as well as the Sorter. 

The PDFPageFormatter is a graphical interface that is useful for setting the page size and frames (for the drawing objects) in the final PDF. The order of the frames can be changed by right-clicking on the input port and choosing to move up or move down.

In the PDFPageFormatter parameters, double-click on PDFStyled and change the following:

  • Input Port: Title_Frame
  • Upper Left X: 2
  • Upper Left Y: 0.3    
  • Width: 4.5
  • Height: 0.7


After clicking OK, you will notice that the layer element has moved into the location specified. If you are unhappy with this location, you can manually move the element by clicking and dragging it to where you would like it placed. 

Double-click on PDFStyled00 and change the following:

  • Input Port: Signature_Frame
  • Upper Left X: 0.5
  • Upper Left Y: 9.9
  • Width: 2.75
  • Height: 0.7

Now double-click on Sorted and change the following:

  • Input Port: Main
  • Upper Left X: 0.5
  • Upper Left Y: 1.2
  • Width: 7.5
  • Height: 8.5

These elements don’t overlap, but if these were elements that did, you could change the order by right-clicking on the element and select either Bring to Front or Send to Back. 

Note: Raster imagery, polygons, and points must always be sent to the same frame to ensure that data is scaled correctly. Separate frames for mapping information should only be used in cases where maps do not occupy the same extent and location; (e.g. inset maps). This is why layers were sent to the Sorter first before the PDFPageFormatter. 

9. Write to PDF
Add an Adobe Geospatial PDF writer to the canvas and name the file AdvancedVotingLocations.pdf. Set the LayerDefinition to Manual and click OK. 


In the Feature Type dialog, set the Layer Name to the fme_feature_type attribute. Then click OK.

Connect the writer feature type to the Output Port on the PDFPageFormatter. By fanning out the individual layers, you will be able to toggle the layers on or off in the PDF document as required.

10. Run the Workspace and View Output
Now save and run the workspace. View the output in a PDF viewer such as Adobe Reader or a web browser. If you want to make any changes to the appearance of the PDF, modify the PDFStylers or the PDFPageFormatter and re-run the workspace. 

Data Attribution

Data used in this tutorial originates from open data made available by the City of Vancouver, British Columbia. It contains information licensed under the Open Government License - Vancouver.

Was this article helpful?



Please sign in to leave a comment.