# PDF - Geospatial PDF

(GDAL/OGR >= 1.10.0)

This driver can rean and write geospatial PDF with vector features.

Read support requires linking to podofo or poppler libraries, but write support does not.

The driver can read vector features encoded according to PDF's logical structure facilities (as described by "§10.6 - Logical Structure" of PDF spec), or retrieve only vector geometries for other vector PDF files.

## Feature style support

For write support, the driver has partial support for the style information attached to features, encoded according to the OGR Feature Style Specification.

The following tools are recognized :

- For points, LABEL and SYMBOL.
- For lines, PEN.
- For polygons, PEN and BRUSH.

The supported attributes for each tool are summed up in the following table :

Tool | Supported attributes | Example
--- | --- | ---
PEN | color, width and dash pattern | PEN(c:#FF0000,w:5px)
BRUSH | foreground color | BRUSH(fc:#0000FF)
LABEL | text (limited to ASCII strings), foreground color, size, x and y offsets, and angle | LABEL(c:#000000,t:"Hello World!",s:5)
SYMBOL | id (ogr-sym-0 to ogr-sym-9, and filenames for raster symbols), color and size | SYMBOL(c:#00FF00,id:"ogr-sym-3",s:10) SYMBOL(c:#00000080,id:"a_symbol.png")

Alpha values are supported for colors to control the opacity. If not specified, for BRUSH, it is set at 50% opaque.

For SYMBOL with a bitmap name, only the alpha value of the color specified with 'c' is taken into account.

## Dataset creation options

- STREAM_COMPRESS=[NONE/DEFLATE]: Set the compression to use for stream objects. DEFLATE is the default.

- DPI=value: Set the DPI to use. Default to 72.

- EXTRA_STREAM=content: A PDF content stream to draw after the vector content, typically to add some text. It may refer the /FTimesRoman and /FTimesBold fonts.

- EXTRA_IMAGES=image_file_name,x,y,scale[,link=some_url] (possibly repeated): A list of (ungeoreferenced) images to insert into the page as extra content. This is usefull to insert logos, legends, etc... x and y are in user units from the lower left corner of the page, and the anchor point is the lower left pixel of the image. scale is a magnifying ratio (use 1 if unsure). If link=some_url is specified, the image will be selectable and its selection will cause a web browser to be opened on the specified URL.

- EXTRA_LAYER_NAME=name: Name for layer where the extra content specified with EXTRA_CONTENT_STREAM is placed.

- MARGIN/LEFT_MARGIN/RIGHT_MARGIN/TOP_MARGIN/BOTTOM_MARGIN=value: Margin around image in user units.

- GEO_ENCODING=[NONE/ISO32000/OGC_BP/BOTH]: Set the Geo encoding method to use. ISO32000 is the default.

- NEATLINE=polygon_definition_in_wkt: Set the NEATLINE to use.

- AUTHOR, CREATOR, CREATION_DATE, KEYWORDS, PRODUCER, SUBJECT, TITLE : metadata that can be written into the PDF Info block.

- OGR_DISPLAY_FIELD=name : Name of the field (matching the name of a field from the OGR layer definition) to use to build the label of features that appear in the "Model Tree" UI component of a well-known PDF viewer. For example, if the OGR layer has a field called "ID", this can be used as the value for that option : features in the "Model Tree" will be labelled from their value for the "ID" field. If not specified, sequential generic labels will be used ("feature1", "feature2", etc... ).

- OGR_DISPLAY_LAYER_NAMES=names : Comma separated list of names to display for the OGR layers in the "Model Tree". This option is useful to provide custom names, instead of OGR layer name that are used when this option is not specified. When specified, the number of names should be the same as the number of OGR layers written (and in the order they are written).

- OGR_WRITE_ATTRIBUTES=YES/NO : Whether to write attributes of OGR features. Defaults to YES

- OGR_LINK_FIELD=name : Name of the field (matching the name of a field from the OGR layer definition) to use to cause clicks on OGR features to open a web browser on the URL specified by the field value.

- OFF_LAYERS=name (possibly repeated): Comma separated list of layer names that should be initially hidden. By default, all layers are visible. The layer names can come from EXTRA_LAYER_NAME and OGR_DISPLAY_LAYER_NAMES.

- EXCLUSIVE_LAYERS=name (possibly repeated): Comma separated list of layer names, such that only one of those layers can be visible at a time. This is the behaviour of radio-buttons in a graphical user interface. he layer names can come from EXTRA_LAYER_NAME and OGR_DISPLAY_LAYER_NAMES.

- JAVASCRIPT=script: Javascript content to run at document opening. See Acrobat(R) JavaScript Scripting Reference.

- JAVASCRIPT_FILE=script_filename: Name of Javascript file to embed and run at document opening. See Acrobat(R) JavaScript Scripting Reference.

## See also

Specifications :

- OGR Feature Style Specification
- OGC GeoPDF Encoding Best Practice Version 2.2 (08-139r3)
- Adobe Supplement to ISO 32000
- PDF Reference, version 1.7

Also:

- GDAL PDF driver