The printing module of MapStore is a back-end service not included by default in the release package that allows to create a printable PDF from the current map.
The printing module is required by the Print plugin of MapStore, so if you want to have the Print plugin working in your application, you have to include also the printing module in your MapStore installation.
Including the printing module in MapStore
Because MapStore doesn't include the printing module by default, to use it you need to build from the source a
MapStore.war that includes it or add the missing files to an existing MapStore deployed.
Building from the Source
If you want to include the printing module in your MapStore, by building the source code, you have to add the profile
printing (profiles can be added as 2nd argument of the
build.sh script, after the version that is the 1st. If you have more then one profile, you can add them separated by
MapStore projects also allow to use the
printing profile to include this module. So you can use the same
printing profile to build your custom MapStore project including the printing module.
Adding to an existing MapStore
If you have an existing and deployed instance of MapStore and you want to add the printing module, you can build only the printing extension as a zip running
mvn clean install -Pprintingbundle. The zip bundle will created in
You can copy the content of this zip bundle into
webapps/mapstore directory of your java container (e.g. Tomcat) following the same directory structure:
- files from zip directory
WEB-INF/classesmust be placed in
- files from zip directory
WEB-INF/libmust be placed in
Then restart your java container.
Configuring the print
!!! note: The module was originally written for GeoServer, so on the Github wiki you can find information about downloading and installing it in GeoServer, but if you include the engine directly in MapStore you don't need any other installation.
The MapStore print module on the front-end is implemented by the
localConfig.json. Make you sure to have this plugin in
plugins/(mode) section. If so, this will will automatically check the presence of the back-end module and show the entry in the Burger Menu, if the back-end service is present.
localConfig.json you will find also a
printUrl configuration that refers to the (relative) URL where the main entry point of the application is available. (the default should enough)
This fork uses the same configuration files of the original library to define the various print layouts and options.
This files is in the directory
resources/geoserver/print, and they will be copied in
WEB-INF/classes in the final
config.yml: The main file that configures the layout. More information about this configuration file in the original documentaiton
print_header.png: The header, referred in
Arrow_north_CFCF.svgthe north indicator, referred in
I can not see the "Print" entry in the menu
Please check if:
- "Print" plugin is present in
localConfig.json --> plugins --> desktop.
- You are using a desktop browser. The plugin is not designed for a mobile devices (tablet, smartphone...), for this reason it is not included in
plugins --> mobile
- The service at url
http(s)://<your-domain>/<applciation-base-paath>/pdf/info.jsonis responding. Example:
https://example.com/mapstore/pdf/info.json. The URL of this
info.jsonis configured (by default as relative URL) in
- Looking at the JSON returned by the request above, the URLs in the entries
createURLare reachable, and the domain, (the port) and the schema (http/https) of these URLs are the same of MapStore.
I have an error printing (using Reverse Proxy/HTTPS)
When you open MapStore from the browser, MapStore do a request to the main entry point (
info.json) of the printing module. This entry point provides a set of URLs where to find all the print related services. These URLs are generated starting from the current request.
A common practice is to use a reverse proxy in front of a Java Application Server, and so MapStore (this is used also to add https, if the reverse proxy is part of a web server). If this reverse proxy is not properly configured anyway, MapStore will not be able to correctly generate the URLs of the printing services, and this may cause an error when you try to print a PDF.
To avoid this problem, you can use several solution, depending on your setup and your reverse proxy.
Setting up your proxy
Some typical solutions are:
- Using AJP instead of http (this forwards all the information by default)
1 2 3
- Using rewrite engine to rewrite the requests. (apache web server)
1 2 3 4 5 6 7 8
- Using non-standard headers,
Forcing PRINT_BASE_URL of printing module
If, for any reason, you can not modify the proxy configuration, MapStore printing module provides a system variable
PRINT_BASE_URL that you can set to force the URLs returned by
info.json to be resolved from it.
A useful trick can be to set as a relative URL (relative to MapStore) to make it work in any context (only for MapStore).
or you can use the absolute URL: