PJsonObject specJson = MapPrinter.parseSpec(jsonConfig);
if (Log.isDebugEnabled(LOGGER_NAME)) {
Log.debug(LOGGER_NAME, "Generating thumbnail from config: " +
jsonConfig);
}
final OutputFormat outputFormat =
getMapPrinter().getOutputFormat(specJson);
File tempFile = File.createTempFile("thumbnail",
"." + outputFormat.getFileSuffix());
FileOutputStream out = null;
try {
out = new FileOutputStream(tempFile);
PrintParams params = new PrintParams(
getMapPrinter().getConfig(),
configFile.getParentFile(),
specJson,
out,
new HashMap<String, String>());
outputFormat.print(params);
} catch (IOException e) {
throw e;
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
if (out != null) {
out.close();
}
}
if (rotationAngle != null) {
rotate(tempFile, outputFormat.getFileSuffix(), rotationAngle);
}
return tempFile;
}