Opened 14 years ago

Closed 13 years ago

#5 closed enhancement (duplicate)

Print service and server-side requirements

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 see a whole lot of files being downloaded and ultimately you'll 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. If everything went fine, clicking on the "Print" button at the bottom of the page should pop back a PDF file.

  • 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 (11)

comment:1 by yvesm, 14 years ago

Version: 1.00.7

comment:2 by yvesm, 14 years ago

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

comment:3 by yvesm, 14 years ago

Summary: Print widget and servicePrint service

comment:4 by yvesm, 14 years ago

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

comment:5 by yvesm, 14 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, 14 years ago

Description: modified (diff)

comment:7 by yvesm, 14 years ago

Description: modified (diff)

comment:8 by yvesm, 14 years ago

Milestone: First milestone

in reply to:  description comment:9 by yvesm, 14 years ago

Replying to yvesm:

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

  • Server-side requirements

None of the above build instructions are valid anymore because C2C has dropped Maven in favor of Gradle : http://lists.mapfish.org/pipermail/dev/2010-March/000565.html

comment:10 by yvesm, 14 years ago

New mapfish server build instructions are now much simpler :

Read README in .../geoprisma/trunk/lib/externals/mapfish-print/; this will tell you to run gradlew.bat :

...\geoprisma\trunk\lib\externals\mapfish-print>gradlew.bat
Downloading http://dist.codehaus.org/gradle/gradle-0.8-bin.zip

[and then a slew of jars]

...
downloading (60 KB) http://repo1.maven.org/maven2/org/apache/xmlgraphics/batik-script/1.7/batik-script-1.7.jar
.....
downloading (504 KB) http://repo1.maven.org/maven2/org/apache/xmlgraphics/batik-js/1.7/batik-js-1.7.jar
.....................
:: problems summary ::
:::: WARNINGS
        Resolution will only pick dependencies of the relocated element.  Artefact and other metadata will be ignored.

:::: ERRORS
        Relocation to an other version number not supported in ivy : xml-apis#xml-apis;2.0.2 relocated to xml-apis#xml-a
pis;1.0.b2. Please update your dependency to directly use the right version.

[WARNING] Private key was not found.  The 'privateKey' property is referenced as well as the ~/.ssh directory for the ke
y file
[WARNING] SSL passphrase was not found.  Set '-DsshPassphrase=<password>' property on gradle launch
:compileJava
Note: ...\geoprisma\trunk\lib\externals\mapfish-print\src\main\java\org\mapfish\print\map\readers\VectorMapReader.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: ...\geoprisma\trunk\lib\externals\mapfish-print\src\main\java\org\mapfish\print\utils\PJsonObject.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:processResources
:classes
:jar
:war
:standalone [takes a few minutes]
[ant:unzip] Unable to expand to file ...\geoprisma\trunk\lib\externals\mapfish-print\build\.standalone\LICENSE

BUILD SUCCESSFUL

Total time: 5 mins 33.297 secs
...\geoprisma\trunk\lib\externals\mapfish-print>

Then you have two jars and a wa file in ...\geoprisma\trunk\lib\externals\mapfish-print\build\libs.

comment:11 by adube, 13 years ago

Resolution: duplicate
Status: newclosed

It slipped my mind to check that this ticket already existed when creating #147. So it covers the work this one was trying to do, I'm closing this one as a duplicate of #147.

Thanks

Note: See TracTickets for help on using tickets.