Package org.mapfish.print
Class MapPrinter
java.lang.Object
org.mapfish.print.MapPrinter
The main class for printing maps. Will parse the spec, create the PDF document and generate it.
This class should not be directly created but rather obtained from an application context object so that all plugins and dependencies are correctly injected into it
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal Configuration
final OutputFormat
getOutputFormat
(PJsonObject specJson) Get the object responsible for printing to the correct output format.Return the available format ids.static PJsonObject
Parse the JSON string and return the object.print
(Map<String, String> mdcContext, PJsonObject specJson, OutputStream out) Start a print.final void
printClientConfig
(org.json.JSONWriter json) Use by /info.json to generate its returned content.final void
setConfiguration
(File newConfigFile) Set the configuration file and update the configuration for this printer.final void
setConfiguration
(URI newConfigFile, byte[] configFileData) Set the configuration file and update the configuration for this printer.
-
Constructor Details
-
MapPrinter
public MapPrinter()
-
-
Method Details
-
parseSpec
Parse the JSON string and return the object. The string is expected to be the JSON print data from the client.- Parameters:
spec
- the JSON formatted string.- Returns:
- The encapsulated JSON object
-
setConfiguration
Set the configuration file and update the configuration for this printer.- Parameters:
newConfigFile
- the file containing the new configuration.configFileData
- the config file data.- Throws:
IOException
-
getConfiguration
-
setConfiguration
Set the configuration file and update the configuration for this printer.- Parameters:
newConfigFile
- the file containing the new configuration.- Throws:
IOException
-
printClientConfig
public final void printClientConfig(org.json.JSONWriter json) throws org.json.JSONException Use by /info.json to generate its returned content.- Parameters:
json
- the writer for outputting the config specification- Throws:
org.json.JSONException
-
getOutputFormat
Get the object responsible for printing to the correct output format.- Parameters:
specJson
- the request json from the client
-
print
public final Processor.ExecutionContext print(@Nonnull Map<String, String> mdcContext, PJsonObject specJson, OutputStream out) throws ExceptionStart a print.- Parameters:
mdcContext
- the MDC context for the current print job.specJson
- the client json request.out
- the stream to write to.- Throws:
Exception
-
getOutputFormatsNames
Return the available format ids.
-