Fix PDF export.

This commit is contained in:
Paulo Gustavo Veiga 2012-06-03 18:12:56 -03:00
parent f52a75ac79
commit b914bbb8a8
7 changed files with 7 additions and 10 deletions

View File

@ -22,7 +22,7 @@ import org.jetbrains.annotations.NotNull;
public enum ExportFormat { public enum ExportFormat {
SVG("image/svg+xml", "svg"), SVG("image/svg+xml", "svg"),
JPEG("image/jpeg", "jpg"), JPG("image/jpeg", "jpg"),
PNG("image/png", "png"), PNG("image/png", "png"),
PDF("application/pdf", "pdf"), PDF("application/pdf", "pdf"),
FREEMIND("application/freemind", "mm"), FREEMIND("application/freemind", "mm"),

View File

@ -32,7 +32,7 @@ public class ExportProperties {
public static ExportProperties create(final ExportFormat format) { public static ExportProperties create(final ExportFormat format) {
ExportProperties result; ExportProperties result;
if (format == ExportFormat.JPEG || format == ExportFormat.PNG) { if (format == ExportFormat.JPG || format == ExportFormat.PNG) {
result = new ImageProperties(format); result = new ImageProperties(format);
} else { } else {
result = new GenericProperties(format); result = new GenericProperties(format);

View File

@ -18,7 +18,6 @@
package com.wisemapping.exporter; package com.wisemapping.exporter;
import com.wisemapping.model.MindMap;
import org.apache.batik.transcoder.Transcoder; import org.apache.batik.transcoder.Transcoder;
import org.apache.batik.transcoder.TranscoderException; import org.apache.batik.transcoder.TranscoderException;
import org.apache.batik.transcoder.TranscoderInput; import org.apache.batik.transcoder.TranscoderInput;
@ -79,7 +78,7 @@ public class ExporterFactory {
transcoder.transcode(input, trascoderOutput); transcoder.transcode(input, trascoderOutput);
break; break;
} }
case JPEG: { case JPG: {
// Create a JPEG transcoder // Create a JPEG transcoder
final Transcoder transcoder = new JPEGTranscoder(); final Transcoder transcoder = new JPEGTranscoder();
transcoder.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(.99)); transcoder.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(.99));

View File

@ -28,7 +28,6 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -116,7 +115,7 @@ public class TransformerController extends BaseController {
case PNG: case PNG:
result = this.transformPng(svg); result = this.transformPng(svg);
break; break;
case JPEG: case JPG:
result = this.transformJpeg(svg); result = this.transformJpeg(svg);
break; break;
case PDF: case PDF:

View File

@ -83,7 +83,7 @@ public class TransformView extends AbstractView {
ExporterFactory.export(properties, content, outputStream, null); ExporterFactory.export(properties, content, outputStream, null);
} else if (exportFormat == ExportFormat.WISEMAPPING) { } else if (exportFormat == ExportFormat.WISEMAPPING) {
final Object mindmap = viewMap.get("mindmap"); final Object mindmap = viewMap.get("mindmap");
StreamResult result = new StreamResult(outputStream); final StreamResult result = new StreamResult(outputStream);
jaxbMarshaller.marshal(mindmap, result); jaxbMarshaller.marshal(mindmap, result);
} else { } else {
ExporterFactory.export(properties, null, outputStream, content); ExporterFactory.export(properties, null, outputStream, content);

View File

@ -37,9 +37,8 @@
<entry key="freemind" value="application/freemind"/> <entry key="freemind" value="application/freemind"/>
<entry key="pdf" value="application/pdf"/> <entry key="pdf" value="application/pdf"/>
<entry key="png" value="image/png"/> <entry key="png" value="image/png"/>
<entry key="jpeg" value="image/jpg"/> <entry key="jpg" value="image/jpeg"/>
<entry key="svg" value="image/svg+xml"/> <entry key="svg" value="image/svg+xml"/>
<entry key="svg" value="application/svg+xml"/>
<entry key="wxml" value="application/wisemapping+xml"/> <entry key="wxml" value="application/wisemapping+xml"/>
</map> </map>
</property> </property>

View File

@ -39,7 +39,7 @@
<select name="imgFormat" id="imgFormat" style="display:none"> <select name="imgFormat" id="imgFormat" style="display:none">
<option value='png'>PNG</option> <option value='png'>PNG</option>
<option value='jpeg'>JPEG</option> <option value='jpg'>JPEG</option>
</select> </select>
</label> </label>
</fieldset> </fieldset>