Improve img quality export.
@ -45,6 +45,7 @@ import javax.xml.transform.TransformerFactory;
|
|||||||
import javax.xml.transform.dom.DOMSource;
|
import javax.xml.transform.dom.DOMSource;
|
||||||
import javax.xml.transform.stream.StreamResult;
|
import javax.xml.transform.stream.StreamResult;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class ExporterFactory {
|
public class ExporterFactory {
|
||||||
private static final String GROUP_NODE_NAME = "g";
|
private static final String GROUP_NODE_NAME = "g";
|
||||||
@ -147,6 +148,9 @@ public class ExporterFactory {
|
|||||||
svgXml = svgXml.replaceAll("NaN,", "0");
|
svgXml = svgXml.replaceAll("NaN,", "0");
|
||||||
svgXml = svgXml.replaceAll(",NaN", "0");
|
svgXml = svgXml.replaceAll(",NaN", "0");
|
||||||
|
|
||||||
|
// Bratik do not manage nbsp properly.
|
||||||
|
svgXml = svgXml.replaceAll(Pattern.quote(" ")," ");
|
||||||
|
|
||||||
Document document;
|
Document document;
|
||||||
try {
|
try {
|
||||||
final Reader in = new CharArrayReader(svgXml.toCharArray());
|
final Reader in = new CharArrayReader(svgXml.toCharArray());
|
||||||
|
@ -59,14 +59,8 @@ public class TransformView extends AbstractView {
|
|||||||
// Build format properties ...
|
// Build format properties ...
|
||||||
final ExportProperties properties = ExportProperties.create(exportFormat);
|
final ExportProperties properties = ExportProperties.create(exportFormat);
|
||||||
if (properties instanceof ExportProperties.ImageProperties) {
|
if (properties instanceof ExportProperties.ImageProperties) {
|
||||||
final String sizeStr = request.getParameter(IMG_SIZE_PARAMETER);
|
|
||||||
final ExportProperties.ImageProperties imageProperties = (ExportProperties.ImageProperties) properties;
|
final ExportProperties.ImageProperties imageProperties = (ExportProperties.ImageProperties) properties;
|
||||||
if (sizeStr != null) {
|
imageProperties.setSize(ExportProperties.ImageProperties.Size.LARGE);
|
||||||
final ExportProperties.ImageProperties.Size size = ExportProperties.ImageProperties.Size.valueOf(sizeStr);
|
|
||||||
imageProperties.setSize(size);
|
|
||||||
} else {
|
|
||||||
imageProperties.setSize(ExportProperties.ImageProperties.Size.MEDIUM);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set format content type...
|
// Set format content type...
|
||||||
@ -103,6 +97,4 @@ public class TransformView extends AbstractView {
|
|||||||
public String getContentType() {
|
public String getContentType() {
|
||||||
return contentType;
|
return contentType;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String IMG_SIZE_PARAMETER = "imgSize";
|
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,7 @@
|
|||||||
<i><b>This is bold </b></i>
|
<i><b>This is bold </b></i>
|
||||||
</p>
|
</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html></richcontent>
|
||||||
</richcontent>
|
|
||||||
<node CREATED="1354384204994" ID="ID_1523964881" MODIFIED="1354384740867" POSITION="right" TEXT="Child Node">
|
<node CREATED="1354384204994" ID="ID_1523964881" MODIFIED="1354384740867" POSITION="right" TEXT="Child Node">
|
||||||
<richcontent TYPE="NOTE"><html>
|
<richcontent TYPE="NOTE"><html>
|
||||||
<head>
|
<head>
|
||||||
@ -33,8 +32,7 @@
|
|||||||
This is a simple note
|
This is a simple note
|
||||||
</p>
|
</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html></richcontent>
|
||||||
</richcontent>
|
|
||||||
</node>
|
</node>
|
||||||
</node>
|
</node>
|
||||||
</map>
|
</map>
|
||||||
|
BIN
wise-webapp/src/test/resources/data/svg/bug-nbsp.png
Normal file
After Width: | Height: | Size: 357 KiB |
2251
wise-webapp/src/test/resources/data/svg/bug-nbsp.svg
Normal file
After Width: | Height: | Size: 174 KiB |
Before Width: | Height: | Size: 153 KiB After Width: | Height: | Size: 155 KiB |
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 75 KiB |
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 154 KiB After Width: | Height: | Size: 165 KiB |
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 71 KiB |
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 69 KiB |
Before Width: | Height: | Size: 116 KiB After Width: | Height: | Size: 118 KiB |