Improve img quality export.

This commit is contained in:
Paulo Gustavo Veiga 2012-12-01 17:58:01 -03:00
parent bad11bea88
commit d2c287684f
12 changed files with 2258 additions and 13 deletions

View File

@ -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());

View File

@ -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";
} }

View File

@ -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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 KiB

After

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 KiB

After

Width:  |  Height:  |  Size: 165 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 118 KiB