Opened 15 years ago

Last modified 14 years ago

#5 closed enhancement

Print service and server-side requirements — at Version 6

Reported by: yvesm Owned by: sguillemette
Priority: major Milestone: First milestone
Component: server Version: 0.7
Keywords: Cc:

Description (last modified by yvesm)

Implement theMapFish print server. Here's what needs to be done.

  • Server-side requirements
  • Install Maven (http://maven.apache.org/download.html)
  • Put install path (on windows : C:\Program Files\apache-maven-2.2.0\bin) on the system path (follow instructions at http://maven.apache.org/download.html for specific environment variables settings like JAVA_HOME)
  • Test on a commandline : ' mvn -version'
  • Create the war file : 'cd' to directory .../geoprisma/trunk/lib/externals/mapfish-print/; you should find a bunch of subdirectories there (print-lib, print-servlet, print-standalone) as well as the POM.xml file that Maven requires; the POM file there references the three POM files found in subdirectories, one of which (print-servlet) generates a war; the other two generate a jar
  • At the prompt type : 'mvn clean install'; once you do that, you will get a bunch of 'target' directories in the print-* directories
  • Deploy the war file in a Tomcat container : in the .../print-servlet/target directory, grab the .war file and copy it to your Tomcat/web; if your Tomcat is running, you should see a new directory created in the web directory and you can use it as a url from your root Tomcat url, e.g.
    http://localhost:9998/print-servlet-1.2-SNAPSHOT/
    

where 'http://localhost:9998/' is the Tomcat root and 'print-servlet-1.2-SNAPSHOT' is the newly created directory

  • Apache conf
  • In the GeoPrisma Apache conf, create a reverse proxy to direct requests to the print server, e.g.;
    	LoadModule proxy_module modules/mod_proxy.so
    	LoadModule proxy_connect_module modules/mod_proxy_connect.so
    	LoadModule proxy_http_module modules/mod_proxy_http.so
    	LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
    
    	ProxyRequests Off
    	<Proxy *>
    		Order deny,allow
    		Allow from all
    	</Proxy>
    	ProxyPass /print http://localhost:9998/print-servlet-1.2-SNAPSHOT/pdf
    	ProxyPassReverse /print http://localhost:9998/print-servlet-1.2-SNAPSHOT/pdf
    

  • Add this variable to configure the print server url:
        var printConfigUrl = '/print/info.json'; 
    
  • GeoPrisma service implementation
  • Implement a new service
  • Implement a new 'print proxy' to that service
  • Make sure the print proxy can use proxy classes to resolve service url and to modify the url string contained in the JSON object sent to the print server, e.g.
    	http://localhost:9998/print-servlet-1.2-SNAPSHOT/
    	
    	See baseURL. 
    	{
        layout: 'A4 portrait',
        title: 'A simple example',
        srs: 'EPSG:4326',
        units: 'dd',
        layers: [
            {
                type: 'WMS',
                format: 'image/png',
                layers: ['basic'],
                baseURL: 'http://labs.metacarta.com/wms/vmap0'
            },
            {
                type: 'WMS',
                format: 'image/png',
                layers: ['routes'],
                baseURL: 'http://www.camptocamp.org/cgi-bin/mapserv_c2corg',
                customParams: {TRANSPARENT:true}
            }
        ],
        pages: [
            {
                center: [6, 45.5],
                scale: 4000000,
                dpi: 190,
                mapTitle: "First map",
                comment: "The \"routes\" layer is not shown (the scale is too small)",
                data: [
                    {id:1, name: 'blah', icon: 'icon_pan'},
                    {id:2, name: 'blip', icon: 'icon_zoomin'}
                ]
            },
            {
                center: [6.9, 46.2],
                scale: 500000,
                dpi: 190,
                mapTitle: "Second map",
                comment: "This is a zoomed in version of the first map. Since the scale is more appropriate, we show the \"routes\" layer.",
                data: [
                    {id:1, name: 'blah', icon: 'icon_pan'},
                    {id:2, name: 'blip', icon: 'icon_zoomin'}
                ]
            }
        ]
    }
    

GeoPrisma will replace the url shown above by that of the print proxy and the various GeoPrisma proxy parameters. The print proxy will re-map the url to the one specified in the Apache conf file

Change History (6)

comment:1 by yvesm, 15 years ago

Version: 1.00.7

comment:2 by yvesm, 15 years ago

Component: widgets -- printserver
Description: modified (diff)

comment:3 by yvesm, 15 years ago

Summary: Print widget and servicePrint service

comment:4 by yvesm, 15 years ago

Description: modified (diff)
Summary: Print servicePrint service and server-side requirements

comment:5 by yvesm, 15 years ago

Someone is cooking a GeoExt ux component for printing : http://trac.geoext.org/changeset/1541. We should strive to make that happen.

comment:6 by yvesm, 15 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.