hi there,
The library is really easy to use, but when my client translate emf file to png, which contains some chinese characters, these characters in the png file are missing, instead, some rectangles is showed. The code is copied from github .is there any solution?
public static byte[] transWmf(byte[] src) throws Exception {
Image image = Image.load(new ByteArrayInputStream(src));
ByteArrayOutputStream output = new ByteArrayOutputStream();
try {
// Calculate new height
double k = (image.getWidth() * 1.00) / image.getHeight();
// Create an instance of EmfRasterizationOptions class and define
EmfRasterizationOptions emf = new EmfRasterizationOptions();
emf.setPageWidth(400);
emf.setPageHeight((int) Math.round(400 / k));
emf.setBorderX(5);
emf.setBorderY(10);
emf.setBackgroundColor(Color.getWhiteSmoke());
PngOptions options = new PngOptions();
options.setVectorRasterizationOptions(emf);
// Call the save method, provide output path and PngOptions to
// convert the WMF file to PNG and save the output
image.save(output, options);
} catch (Exception e){
return null;
} finally {
image.dispose();
}
return output.toByteArray();
}