﻿{"id":7512,"date":"2018-12-07T05:23:33","date_gmt":"2018-12-07T04:23:33","guid":{"rendered":"http:\/\/www.sigterritoires.fr\/?p=7512"},"modified":"2023-04-28T14:58:53","modified_gmt":"2023-04-28T12:58:53","slug":"print-web-maps-with-geoserver-avoid-the-plugin","status":"publish","type":"post","link":"https:\/\/www.sigterritoires.fr\/index.php\/en\/print-web-maps-with-geoserver-avoid-the-plugin\/","title":{"rendered":"Print web maps with geoserver: avoid the plugin!"},"content":{"rendered":"\n<p>We will discuss here how to set up a solution to generate pdf for printing from an interactive mapping page, the OpenLayers 4 encoded page and the Geoserver 2.14 server. Technically, to read the Geoserver doc,everything should be very simple: Geoserver <strong>Print<\/strong> plugin installation , installing test, configuration and that&rsquo;s it<\/p>\n\n\n\n<!--more-->\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"795\" data-attachment-id=\"7514\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/print-web-maps-with-geoserver-avoid-the-plugin\/71-3\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/71-1.png?fit=525%2C795&amp;ssl=1\" data-orig-size=\"525,795\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"71\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/71-1.png?fit=525%2C795&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/71-1.png?resize=525%2C795&#038;ssl=1\" alt=\"\" class=\"wp-image-7514\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/71-1.png?w=525&amp;ssl=1 525w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/71-1.png?resize=198%2C300&amp;ssl=1 198w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/figure>\n\n\n\n<p>Although installation is quick and easy, the problems start when you want to use the proposed test page to make sure everything is working properly.Impossible to make it work and each time we find the source of the problem and solve it, a new error message appears and another problem arises. <\/p>\n\n\n\n<p>The script paths are no longer valid, the contents of the libraries have changed, in short, if you want to waste your time, you can always try. <\/p>\n\n\n\n<p>You can also look for solutions on the net and as me, find posts in forums with the same questions asked &#8230; and without any answer. <\/p>\n\n\n\n<p><strong>Let&rsquo;s start from the very beginning&#8230; <\/strong><\/p>\n\n\n\n<p>The print module must generate a pdf file containing a map and information. This map is produced by Geoserver and the request is generated by an html page written with OpenLayers. Even if you can do it all without another library, you often use the GeoExt library which simplifies the application coding.<\/p>\n\n\n\n<p>As for the generation of the pdf, it relies on the java Mapfish Print\nlibrary. <\/p>\n\n\n\n<p>If for one, Geoserver version does not affect the result, it is not the same for the other components. <\/p>\n\n\n\n<p>The installation described in the Geoserver documentation refers to Mapfish version 2. It has been replaced by MapFish3 since 2015. It should be understood that the two versions are completely different in terms of syntax and workflow. <\/p>\n\n\n\n<p>MapFish V2 is used with the GeoExt V2 library which relies on OpenLayers\n2. That is to say old versions. <\/p>\n\n\n\n<p>If you are working with\nOpenLayers 4 or 5, the version of GeoExt to use is version 3, and the Mapfish version\n3. <\/p>\n\n\n\n<p><strong>Therefore, the installation the Geoserver print plugin (MapFish V2) is not needed.<\/strong> <\/p>\n\n\n\n<p>This is not a problem; MapFish3 can be installed quite easily. The problem or problems come when you are looking in the net for documentation,examples, information on error messages. You will have, anyhow, references of all the versions but without knowing which version it refers to &#8230; <\/p>\n\n\n\n<p><strong>Installing Mapfish 3<\/strong> <\/p>\n\n\n\n<p>The Mapfish Print WAR file is a Java archive that can be run on any Javaweb application server such as Tomcat or Jetty. To use Mapfish Print as a stand-alone Web application, you must: <\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Install Java 7 or later <\/li><li>Download the web application server: war file from <a href=\"https:\/\/translate.google.com\/translate?hl=en&amp;prev=_t&amp;sl=auto&amp;tl=en&amp;u=http:\/\/mapfish.github.io\/mapfish-print-doc\/download.html\">http:\/\/mapfish.github.io\/mapfish-print-doc\/download.html<\/a><\/li><li>Place the WAR print Mapfish file in the web apps directory of the web application server. <\/li><li>Rename the Mapfish Print WAR file to a more practical name, such as print.war (the name will be part of the URL). <\/li><li>Start the web application server(Tomcat or Jetty) <\/li><\/ul>\n\n\n\n<p>Verify that the application is running correctly by visiting http: \/\/ localhost: 8080 \/ print \/ index.html. <br><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"428\" data-attachment-id=\"7515\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/print-web-maps-with-geoserver-avoid-the-plugin\/72-3\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/72-1.png?fit=525%2C428&amp;ssl=1\" data-orig-size=\"525,428\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"72\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/72-1.png?fit=525%2C428&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/72-1.png?resize=525%2C428&#038;ssl=1\" alt=\"\" class=\"wp-image-7515\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/72-1.png?w=525&amp;ssl=1 525w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/72-1.png?resize=300%2C245&amp;ssl=1 300w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/figure>\n\n\n\n<p>For the time being, do not do anything with this page. The fact that it is displayed is sufficient to confirm that the installation of MapFish has been successful. <\/p>\n\n\n\n<p><strong>How Mapfish 3 works<\/strong> The lack of online documentation is difficult to grasp because there is no clear introduction to the general architecture \u00a0\u00a0<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"371\" data-attachment-id=\"7516\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/print-web-maps-with-geoserver-avoid-the-plugin\/73-3\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/73-1.png?fit=525%2C371&amp;ssl=1\" data-orig-size=\"525,371\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"73\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/73-1.png?fit=525%2C371&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/73-1.png?resize=525%2C371&#038;ssl=1\" alt=\"\" class=\"wp-image-7516\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/73-1.png?w=525&amp;ssl=1 525w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/73-1.png?resize=300%2C212&amp;ssl=1 300w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/figure>\n\n\n\n<p>In order for the user to obtain a document of this type by clicking on a button \u00ab \u00a0 To print \u00a0 \u00bb located on a page with an interactive map(html page with code OpenLayers) there are three elements to consider: <\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>A form template created with Jasper Studio <\/li><li>a config.yaml file configured on the print server <\/li><li>an element \u201cspecs\u201d\u00a0 to be added to the POST or GET order of the html page <\/li><\/ul>\n\n\n\n<p>Let&rsquo;s discuss in more detail.<\/p>\n\n\n\n<p><strong>Form template<\/strong> \n\nTo create the form we use <strong><em>Jaspersoft\nStudio<\/em><\/strong> . You can download it <a href=\"https:\/\/translate.google.com\/translate?hl=en&amp;prev=_t&amp;sl=auto&amp;tl=en&amp;u=https:\/\/sourceforge.net\/projects\/jasperstudio\/\">from this page<\/a> .\n\n\n\n<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"302\" data-attachment-id=\"7517\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/print-web-maps-with-geoserver-avoid-the-plugin\/74-3\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/74-1.png?fit=525%2C302&amp;ssl=1\" data-orig-size=\"525,302\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"74\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/74-1.png?fit=525%2C302&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/74-1.png?resize=525%2C302&#038;ssl=1\" alt=\"\" class=\"wp-image-7517\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/74-1.png?w=525&amp;ssl=1 525w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/74-1.png?resize=300%2C173&amp;ssl=1 300w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/figure>\n\n\n\n<p><strong><em>JasperStudio<\/em><\/strong> allows you to create a form template where you can place blocks of text, images, maps and captions but also other blocks such as \u00a0 graphics \u00a0<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"246\" data-attachment-id=\"7518\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/print-web-maps-with-geoserver-avoid-the-plugin\/75-3\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/75-1.png?fit=525%2C246&amp;ssl=1\" data-orig-size=\"525,246\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"75\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/75-1.png?fit=525%2C246&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/75-1.png?resize=525%2C246&#038;ssl=1\" alt=\"\" class=\"wp-image-7518\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/75-1.png?w=525&amp;ssl=1 525w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/75-1.png?resize=300%2C141&amp;ssl=1 300w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/figure>\n\n\n\n<p>The purpose of this work is to create a .jrxml file with the page template to create. The very content of the page will be defined elsewhere: the layers to be represented, the scale, the <a href=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/qgis-projections-crs\/\">projection<\/a>,&#8230; <\/p>\n\n\n\n<p><strong>Configuration file .yaml<\/strong> <\/p>\n\n\n\n<p>Compared to Mapfish Print version 2, there is always a configuration file in yaml format but it is now much more simple, and focuses on the definition of models: \u00a0 the \u00a0 Jasper files to use (the previous.jrxml), and the \u00a0 parameters to send to the Jasper engine to fill the blocks of the model. Here is an example of a very simple configuration file<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"437\" height=\"307\" data-attachment-id=\"7519\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/print-web-maps-with-geoserver-avoid-the-plugin\/76-3\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/76-1.png?fit=437%2C307&amp;ssl=1\" data-orig-size=\"437,307\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"76\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/76-1.png?fit=437%2C307&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/76-1.png?resize=437%2C307&#038;ssl=1\" alt=\"\" class=\"wp-image-7519\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/76-1.png?w=437&amp;ssl=1 437w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/76-1.png?resize=300%2C211&amp;ssl=1 300w\" sizes=\"auto, (max-width: 437px) 100vw, 437px\" \/><\/figure>\n\n\n\n<p>What has to be understood in this file: <\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>the <strong>A4 portrait<\/strong> line <strong>:! template<\/strong> defines the model name. When we want to use this configuration we will do it by referring to the layout <strong><em>A4portrait<\/em><\/strong> <\/li><li>the <strong>report Template is<\/strong> used to indicate the name of our .jrxml file created with JaspersoftStudio. <\/li><li>the <strong><em>title<\/em><\/strong> and <strong><em>map<\/em><\/strong> <strong>attributes<\/strong> contain the information to be passed to the Jasperengine. This means that we have created a <strong><em>title<\/em><\/strong> box and a <strong><em>map<\/em><\/strong> box in the form template. Here we inform the content of these two boxes. <\/li><\/ul>\n\n\n\n<p>Of course, there are other options available for configuration files. But for now, let&rsquo;s keep it simple. <\/p>\n\n\n\n<p>We have a .jrxml form template and a .yaml configuration file. All that remains is to send the pdf creation request. <\/p>\n\n\n\n<p><strong>Print request<\/strong> <\/p>\n\n\n\n<p>From the html page we will make a POST to the server with a <strong>spec\u00a0<\/strong>parameter that will contain, in json format, the parameters of our print request. <\/p>\n\n\n\n<p>Here is an example of a <strong>spec<\/strong> : <\/p>\n\n\n\n<p>{ <\/p>\n\n\n\n<p>\u00ab\u00a0layout\u00a0\u00bb: \u00ab\u00a0A4\nportrait\u00a0\u00bb, <\/p>\n\n\n\n<p>\u00ab\u00a0attributes\u00a0\u00bb:\n{\u00ab\u00a0map\u00a0\u00bb: { <\/p>\n\n\n\n<p>\u00ab\u00a0center\u00a0\u00bb: [ <\/p>\n\n\n\n<p>5 <\/p>\n\n\n\n<p>45 <\/p>\n\n\n\n<p>] <\/p>\n\n\n\n<p>\u00ab\u00a0rotation\u00a0\u00bb: 0, <\/p>\n\n\n\n<p>\u00ab\u00a0longitudeFirst\u00a0\u00bb: true, <\/p>\n\n\n\n<p>\u00ab\u00a0layers\u00a0\u00bb: [{ <\/p>\n\n\n\n<p>\u00ab\u00a0geoJson\u00a0\u00bb: \u00ab\u00a0file:\n\/\/countries.geojson\u00a0\u00bb, <\/p>\n\n\n\n<p>\u00ab\u00a0style\u00a0\u00bb: { <\/p>\n\n\n\n<p>\u00ab\u00a0*\u00a0\u00bb:\n{\u00ab\u00a0symbolizers\u00a0\u00bb: [{ <\/p>\n\n\n\n<p>\u00ab\u00a0fillColor\u00a0\u00bb: \u00ab\u00a0#\n5E7F99\u00a0\u00bb, <\/p>\n\n\n\n<p>\u00ab\u00a0strokeWidth\u00a0\u00bb: 1, <\/p>\n\n\n\n<p>\u00ab\u00a0fillOpacity\u00a0\u00bb: 1, <\/p>\n\n\n\n<p>\u00ab\u00a0type\u00a0\u00bb:\n\u00ab\u00a0polygon\u00a0\u00bb, <\/p>\n\n\n\n<p>\u00ab\u00a0strokeColor\u00a0\u00bb: \u00ab\u00a0#\nCC1D18\u00a0\u00bb, <\/p>\n\n\n\n<p>\u00ab\u00a0strokeOpacity\u00a0\u00bb: 1 <\/p>\n\n\n\n<p>}]}, <\/p>\n\n\n\n<p>\u00ab\u00a0version\u00a0\u00bb:\n\u00ab\u00a02\u00a0\u00bb <\/p>\n\n\n\n<p>} <\/p>\n\n\n\n<p>\u00ab\u00a0type\u00a0\u00bb:\n\u00ab\u00a0geojson\u00a0\u00bb <\/p>\n\n\n\n<p>}], <\/p>\n\n\n\n<p>\u00ab\u00a0scale\u00a0\u00bb: 100000000, <\/p>\n\n\n\n<p>\u00ab\u00a0projection\u00a0\u00bb:\n\u00ab\u00a0EPSG: 4326\u00a0\u00bb, <\/p>\n\n\n\n<p>\u00ab\u00a0dpi\u00a0\u00bb: 72 <\/p>\n\n\n\n<p>}} <\/p>\n\n\n\n<p>} <\/p>\n\n\n\n<p>The line <strong>\u00ab\u00a0<\/strong>  <strong>layout<\/strong>  <strong>\u00bb:\u00ab<\/strong> <strong>A4 portrait<\/strong>  is used to indicate the link with the config.yaml file with its line <strong>A4 portrait:! Template<\/strong> <\/p>\n\n\n\n<p>In the list of sent attributes, in this simple example, we only have the map to be displayed (\u00a0\u00bb \u00a0 <strong>map<\/strong> \u00ab \u00a0 ) with its formatting parameters (centring, rotation, scale, projection, definition) and, above all,the definition of the layers to be mapped with the definition of their data sources (here a local geoJson file). <\/p>\n\n\n\n<p>In response to this post the page receives the download url of the pdf document produced. To verify this, you can now copy and paste the json code corresponding to the spec in the Test Print window: \u00a0\u00a0<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"510\" data-attachment-id=\"7520\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/print-web-maps-with-geoserver-avoid-the-plugin\/77-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/77.png?fit=525%2C510&amp;ssl=1\" data-orig-size=\"525,510\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"77\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/77.png?fit=525%2C510&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/77.png?resize=525%2C510&#038;ssl=1\" alt=\"\" class=\"wp-image-7520\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/77.png?w=525&amp;ssl=1 525w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/77.png?resize=300%2C291&amp;ssl=1 300w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/figure>\n\n\n\n<p>Click <strong>Create and Get Print<\/strong> or <strong>Post and Poll Print<\/strong> , in return you will get your pdf file: \u00a0<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"332\" data-attachment-id=\"7521\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/print-web-maps-with-geoserver-avoid-the-plugin\/78-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/78.jpg?fit=525%2C332&amp;ssl=1\" data-orig-size=\"525,332\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"78\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/78.jpg?fit=525%2C332&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/78.jpg?resize=525%2C332&#038;ssl=1\" alt=\"\" class=\"wp-image-7521\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/78.jpg?w=525&amp;ssl=1 525w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/78.jpg?resize=300%2C190&amp;ssl=1 300w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/figure>\n\n\n\n<p>The same yaml configuration file and the same jrxml template can be\u00a0 called with different data. Here is another version of the code json spec which requests the data of the countries served in WMS by Geoserver: <\/p>\n\n\n\n<p>{ <\/p>\n\n\n\n<p>\u00ab\u00a0layout\u00a0\u00bb: \u00ab\u00a0A4\nportrait\u00a0\u00bb, <\/p>\n\n\n\n<p>\u00ab\u00a0outputFormat\u00a0\u00bb:\n\u00ab\u00a0pdf\u00a0\u00bb, <\/p>\n\n\n\n<p>\u00ab\u00a0attributes\u00a0\u00bb: { <\/p>\n\n\n\n<p>\u00ab\u00a0map\u00a0\u00bb: { <\/p>\n\n\n\n<p>\u00ab\u00a0projection\u00a0\u00bb:\n\u00ab\u00a0EPSG: 3857\u00a0\u00bb, <\/p>\n\n\n\n<p>\u00ab\u00a0dpi\u00a0\u00bb: 72, <\/p>\n\n\n\n<p>\u00ab\u00a0rotation\u00a0\u00bb: 0, <\/p>\n\n\n\n<p>\u00ab\u00a0center\u00a0\u00bb:\n[-8233518.5005945, 4980320.4059228], <\/p>\n\n\n\n<p>\u00ab\u00a0scale\u00a0\u00bb: 130000000, <\/p>\n\n\n\n<p>\u00ab\u00a0layers\u00a0\u00bb: [ <\/p>\n\n\n\n<p>{ <\/p>\n\n\n\n<p>\u00ab\u00a0baseURL\u00a0\u00bb:\n\u00ab\u00a0http:\/\/carto-dei-brest.fr\/geoserver\/postgres\/wms\u00a0\u00bb, <\/p>\n\n\n\n<p>\u00ab\u00a0opacity\u00a0\u00bb: 1, <\/p>\n\n\n\n<p>\u00ab\u00a0type\u00a0\u00bb:\n\u00ab\u00a0WMS\u00a0\u00bb, <\/p>\n\n\n\n<p>\u00ab\u00a0layers\u00a0\u00bb:\n[\u00ab\u00a0postgres: country\u00a0\u00bb], <\/p>\n\n\n\n<p>\u00ab\u00a0imageFormat\u00a0\u00bb:\n\u00ab\u00a0image \/ png\u00a0\u00bb, <\/p>\n\n\n\n<p>\u00ab\u00a0styles\u00a0\u00bb: [\u00ab\u00a0polygon\u00a0\u00bb], <\/p>\n\n\n\n<p>\u00ab\u00a0customParams\u00a0\u00bb: { <\/p>\n\n\n\n<p>\u00ab\u00a0TRANSPARENT\u00a0\u00bb:\n\u00ab\u00a0true\u00a0\u00bb <\/p>\n\n\n\n<p>} <\/p>\n\n\n\n<p>} <\/p>\n\n\n\n<p>] <\/p>\n\n\n\n<p>} <\/p>\n\n\n\n<p>} <\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p> In the print test page we replace the text json and the result is the following: \u00a0<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"525\" height=\"361\" data-attachment-id=\"7522\" data-permalink=\"https:\/\/www.sigterritoires.fr\/index.php\/en\/print-web-maps-with-geoserver-avoid-the-plugin\/79-2\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/79.jpg?fit=525%2C361&amp;ssl=1\" data-orig-size=\"525,361\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"79\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/79.jpg?fit=525%2C361&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/79.jpg?resize=525%2C361&#038;ssl=1\" alt=\"\" class=\"wp-image-7522\" srcset=\"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/79.jpg?w=525&amp;ssl=1 525w, https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2018\/12\/79.jpg?resize=300%2C206&amp;ssl=1 300w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/figure>\n\n\n\n<p>To go further, you have a presentation of CampToCamp and Mapfish <a href=\"https:\/\/translate.google.com\/translate?hl=en&amp;prev=_t&amp;sl=auto&amp;tl=en&amp;u=http:\/\/mapfish.github.io\/mapfish-print-doc\/index.html\">documentation<\/a> , <\/p>\n\n\n\n<p><strong>And if you use the Geoserver print plugin&#8230; <\/strong><\/p>\n\n\n\n<p>If you still decide to use the plugin provided by Geoserver, you should know that: <\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u00a0there is no way to use Jaspersoft to create a template. Everything you do with Jaspersoft and MapFish 3 you will have to do manually in the config.yaml file. And you will not have the same possibilities as,for example, to include graphics in your pdf output. <\/li><li>the syntax of the yaml file is totally different. You will find its description <a href=\"https:\/\/translate.google.com\/translate?hl=en&amp;prev=_t&amp;sl=auto&amp;tl=en&amp;u=https:\/\/docs.geoserver.org\/latest\/en\/user\/extensions\/printing\/configuration.html\">on this page<\/a> . <\/li><li>If you want to use the GeoExtlibrary examples as a basis for your developments, you will need to install and use the GeoExt2 version. GeoExt 3 is not compatible withthe Geoserver Print module. <\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>We will discuss here how to set up a solution to generate pdf for printing from an interactive mapping page, the OpenLayers 4 encoded page and the Geoserver 2.14 server. Technically, to read the Geoserver doc,everything&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"give_campaign_id":0,"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"sfsi_plus_gutenberg_text_before_share":"","sfsi_plus_gutenberg_show_text_before_share":"","sfsi_plus_gutenberg_icon_type":"","sfsi_plus_gutenberg_icon_alignemt":"","sfsi_plus_gutenburg_max_per_row":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[1260],"tags":[],"class_list":["post-7512","post","type-post","status-publish","format-standard","hentry","category-non-classe-en"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p6XU0A-1Xa","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/posts\/7512","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/comments?post=7512"}],"version-history":[{"count":0,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/posts\/7512\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/media?parent=7512"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/categories?post=7512"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/tags?post=7512"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}