You can pass variable in your spec document that will be used in your configuratoin block:
http://www.mapfish.org/doc/print/configuration.html#id1
In your case, you will use the following config:
mainPage:
pageSize: A4
landscape: false
rotation: true
backgroundPdf: '${configDir}/${company}.pdf' #company is a value in the spec
Your JavaScript will simply add the company
element in your spec:
'"pages":[{' +
'"center":[' + osMap.getCenter().lon + ',' + osMap.getCenter().lat + '],' +
'"mapTitle":"Sample Title",' +
'"company":"MyCompany",'+
'"comment":"This is the map comment",' +
'"scale":200000,' +
'"rotation":0}' +
']}';
Sure, here they go:
- https://groups.google.com/forum/#!topic/geoext-users-archive/CuRNR0Bunao
- http://lists.mapfish.org/pipermail/users/2009-June/001358.html
- http://web.archiveorange.com/archive/v/0qLmXZEGywMbGnqRlv67
However, you can use GMaps v2 API through OpenLayers, and perhaps print it as basemap with MapFish, here it is the source code:
var options = {
singleTile: true,
ratio: 1,
isBaseLayer: true,
wrapDateLine: true,
getURL: function() {
var center = this.map.getCenter().transform("EPSG:3857", "EPSG:4326"),
size = this.map.getSize();
return [
this.url, "¢er=", center.lat, ",", center.lon,
"&zoom=", this.map.getZoom(), "&size=", size.w, "x", size.h
].join("");
}
};
var map = new OpenLayers.Map({
div: "map",
projection: "EPSG:3857",
numZoomLevels: 22,
layers: [
new OpenLayers.Layer.Grid(
"Google Physical",
"http://maps.googleapis.com/maps/api/staticmap?sensor=false&maptype=terrain",
null, options
),
new OpenLayers.Layer.Grid(
"Google Streets",
"http://maps.googleapis.com/maps/api/staticmap?sensor=false&maptype=roadmap",
null, options
),
new OpenLayers.Layer.Grid(
"Google Hybrid",
"http://maps.googleapis.com/maps/api/staticmap?sensor=false&maptype=hybrid",
null, options
),
new OpenLayers.Layer.Grid(
"Google Satellite",
"http://maps.googleapis.com/maps/api/staticmap?sensor=false&maptype=satellite",
null, options
),
// the same layer again, but scaled to allow map sizes up to 1280x1280 pixels
new OpenLayers.Layer.Grid(
"Google Satellite (scale=2)",
"http://maps.googleapis.com/maps/api/staticmap?sensor=false&maptype=satellite&scale=2",
null, OpenLayers.Util.applyDefaults({
getURL: function() {
var center = this.map.getCenter().transform("EPSG:3857", "EPSG:4326"),
size = this.map.getSize();
return [
this.url, "¢er=", center.lat, ",", center.lon,
"&zoom=", (this.map.getZoom() - 1),
"&size=", Math.floor(size.w / 2), "x", Math.floor(size.h / 2)
].join("");
}
}, options)
)
],
center: new OpenLayers.LonLat(10.2, 48.9).transform("EPSG:4326", "EPSG:3857"),
zoom: 5
});
map.addControl(new OpenLayers.Control.LayerSwitcher());
and the OpenLayers example:
http://openlayers.org/dev/examples/google-static.html
Additionally, this nice post may help you if you want to include GMaps + MapServer + TileCache:
http://crschmidt.net/blog/archives/311/using-tilecache-with-google-maps-and-virtual-earth/
Best Answer
Normally it shouldn't be necessary to have multiple configuration files for the mapfish print module because you can make multiple layouts in your config file (with optional parameters) which you then post to the pdf/create.json URL. This page has some info (although it's a little outdated): http://www.mapfish.org/doc/print/configuration.html. In essence you can just add multiple layout descriptions like this:
(note: use ! in front of a parameter to make it optional)
The only way to have multiple configurations (that I know of) is to have multiple print links which all use a separate config. You can do that by editing the /usr/lib/apache-tomcat/webapps/print/WEB-INF/web.xml file and add more servlets:
I hope this gives you enough information to get it working!