| 1 |
WHAT? |
|---|
| 2 |
===== |
|---|
| 3 |
|
|---|
| 4 |
A command line utility or a servlet used to generate a PDF version of some |
|---|
| 5 |
layers. |
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
HOW TO BUILD? |
|---|
| 9 |
============= |
|---|
| 10 |
|
|---|
| 11 |
To build this project, you need: |
|---|
| 12 |
- Maven 2 (http://maven.apache.org/) |
|---|
| 13 |
- JRE >= 1.5 |
|---|
| 14 |
|
|---|
| 15 |
The other external libs are taken care of by maven |
|---|
| 16 |
|
|---|
| 17 |
The build command to use is: |
|---|
| 18 |
cd %PROJECT_DIR%/%MAPFISH_DIR%/server/java/print/ |
|---|
| 19 |
mvn clean install |
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
HOW TO USE IT? |
|---|
| 23 |
============== |
|---|
| 24 |
|
|---|
| 25 |
You need to create a YAML configuration file and add some JavaScript code. |
|---|
| 26 |
Please read this document: |
|---|
| 27 |
http://trac.mapfish.org/trac/mapfish/wiki/PrintModuleDoc |
|---|
| 28 |
|
|---|
| 29 |
From the command line |
|---|
| 30 |
--------------------- |
|---|
| 31 |
This method can be used to test the layouts. |
|---|
| 32 |
|
|---|
| 33 |
Example of command (from the directory SVNROOT/server/java/print/print-standalone): |
|---|
| 34 |
java -Djava.awt.headless=true -cp target/print-standalone.jar org.mapfish.print.ShellMapPrinter --config=samples/config.yaml --spec=samples/spec.json --output=$HOME/print.pdf |
|---|
| 35 |
|
|---|
| 36 |
Behind a pylons component |
|---|
| 37 |
------------------------- |
|---|
| 38 |
|
|---|
| 39 |
This method should be used only for low traffic web sites. It is quite simple to |
|---|
| 40 |
put in place, but may be slow due to the starting time of the JRE environment. |
|---|
| 41 |
|
|---|
| 42 |
To use it within your MapFish project, build the java application and do the |
|---|
| 43 |
following: |
|---|
| 44 |
|
|---|
| 45 |
1) Edit the development.ini file and add two lines like that to the [DEFAULT] |
|---|
| 46 |
section (change the string "MAPFISH" by something relevant): |
|---|
| 47 |
print.jar = %MAPFISHDIR%/server/java/print/print-standalone/target/print-standalone.jar |
|---|
| 48 |
print.config = %PROJECT_DIR%/print/config.yaml |
|---|
| 49 |
|
|---|
| 50 |
2) Edit the MY_PROJECT/config/routing.py file and add those 2 lines (just after |
|---|
| 51 |
the "CUSTOM ROUTES HERE"): |
|---|
| 52 |
from mapfish.controllers import printer |
|---|
| 53 |
printer.addRoutes(map, 'print/', 'printer') |
|---|
| 54 |
|
|---|
| 55 |
3) Create a MY_PROJECT/controllers/printer.py file with this single line as |
|---|
| 56 |
content: |
|---|
| 57 |
from mapfish.controllers.printer import PrinterController |
|---|
| 58 |
|
|---|
| 59 |
4) If you use the MapFish deploy architecture, add this to your "defaults" file, |
|---|
| 60 |
at the end of the post_fetch_project function and re-deploy: |
|---|
| 61 |
(cd $PROJECT_MAPFISH_DIR/server/java/print/; mvn install || echo "Cannot compile the print module!!!!!!") |
|---|
| 62 |
|
|---|
| 63 |
5) If you use WSGI, you must add the following line into %PROJECT_DIR%/%PROJECT_NAME%/%PROJECT_NAME%.wsgi (or .wsgi.in) |
|---|
| 64 |
before the "loadapp" call : |
|---|
| 65 |
# configure the logging system |
|---|
| 66 |
from paste.script.util.logging_config import fileConfig |
|---|
| 67 |
fileConfig('%PASTE_CONFIG%') |
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
As a tomcat servlet |
|---|
| 71 |
------------------- |
|---|
| 72 |
|
|---|
| 73 |
If you already have a tomcat server running or you have performance issues, this |
|---|
| 74 |
is the way to go. |
|---|
| 75 |
|
|---|
| 76 |
To install it, deploy the WAR file located in this directory: |
|---|
| 77 |
SVNROOT/server/java/print/print-servlet/target |
|---|
| 78 |
|
|---|
| 79 |
Eventually, edit the web.xml and log4j.properties files. The config.yaml file |
|---|
| 80 |
is located in the webapp's root directory. |
|---|