PDF Support in Mapserver 3.7
Recently the support of PDF output has been added to Mapserver 3.7 in addition to other output formats such as GD based formats (GIF, PNG, …) and vector outputs like SWF.
Previous versions of Mapserver had support for pdf output using a utility program (shp2pdf) to output a pdf file given a mapserver map file.
The difference in this new version is that the output to PDF can now be directly specified in the map file using the IMAGETYPE or the OUPUTFORMAT parameters in the map file. Additionaly, raster layers are now supported for pdf output.
Note that the utility program shp2pdf can still be used in Mapserver 3.7.
In order to have access to the PDF support in Mapserver, you should download and build the PDF library from http://www.pdflib.com/pdflib/.
Please follow the instructions on the PDFLib site to build on your specific platforms.
Here are some quick notes on how to build on windows:
· Download and extract the source code from http://www.pdflib.com/pdflib/download/pdflib-4.0.3.zip
· open the project PDFLib.dsw in MS Visual C++
· build the project pdflib_dll
· after a sucessful build, you should have a pdflib.lib and pdblib.dll under the pdflib directory
· copy the pdflib.dll under your system directory (ex : c:/winnt/system32)
· the pdflib.lib will be used while building mapserver with the PDF support
Edit the makefile.vc and uncomment the following lines (make sure that the paths are adapted to your installation):
Add –with-pdf to your configure command line before compiling.
1) Vector Layers
· Layer Point: supported
· Layer Line: supported
Note: Lines drawn with symbols are not supported.
· Layer Polygon: supported
Note: Polygons filled with symbols are not supported.
· Layer Circle : not supported
· Layer Annotation: supported
2) Raster Layers
Raster layers are supported. Note that at this point all raster layers are transformed to jpeg format before being written to the PDF file.
3) WMS Layers
Not yet supported
4) Surround components : :Legend, scalebar are not supported.
The IMAGETYPE paramter in the map file should be set to pdf in order to output to PDF: IMAGETYPE pdf
You can also specify the output using the OUTPUTFORMAT tag (this tag has been introduced in mapserver 3.7) :
FORMATOPTION "OUTPUT_TYPE=RASTER" //not mandatory
If the OUTPUT_TYPE=RASTER all the layers will be rendered as rasters. Note that when WMS layers are included in the map file, this option should be set since there is a problem with transparency and wms layers.