EMF to SVG fonts issue


#1

Hi there,

We have an issue with EMF to SVG conversion on Linux/Unix servers.

When we try to convert the attached EMF image to SVG, the conversion is unsuccessful with very generic error “Cannot find any fonts installed on the system”, it never prints the font details that caused this exception.

Can we have the font details logged along with the exception that caused this issue ?

Code Snippet :

String dataDir = "C:\\emf-with-svg-content\\";	 
Image image = Image.load(dataDir + "image9.emf", new MetafileLoadOptions(true));
try {
	// Create an instance of EmfRasterizationOptions class and set
	// different options
	final EmfRasterizationOptions emfRasterizationOptions = new EmfRasterizationOptions();
	emfRasterizationOptions.setPageWidth(image.getWidth());
	emfRasterizationOptions.setPageHeight(image.getHeight());
	
	
	// call the save method and pass instance of SvgOptions class to
	// convert it to SVG format.
	image.save(dataDir + "image9.svg", new SvgOptions() {
		{
			setVectorRasterizationOptions(emfRasterizationOptions);
			
		}
	});
} finally {
	image.dispose();
}

Exception log :
|ERROR|5308028|ImageGenerationUtil|Exception while converting the image image8.emf->
com.aspose.imaging.coreexceptions.ImageSaveException: Image export failed.
at com.aspose.imaging.Image.a(Unknown Source)
at com.aspose.imaging.Image.save(Unknown Source)
at com.aspose.imaging.Image.save(Unknown Source)
at com.citi.icg.rendition.conversion.document.util.ImageGenerationUtil.convertEMFOrWMFImage(ImageGenerationUtil.java:469)
at com.citi.icg.rendition.conversion.document.util.ImageGenerationUtil.saveEMFOrWMFImage(ImageGenerationUtil.java:161)
.
.
.
.
at com.citi.icg.rendition.conversion.document.DocumentGenerator.generateJson(DocumentGenerator.java:86)
at com.citi.icg.rendition.conversion.document.DocumentGenerator.converttoJsonExternal(DocumentGenerator.java:860)
at com.citi.icg.rendition.conversion.document.DocumentGenerator$$FastClassBySpringCGLIB$$93f6e5fc.invoke()
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:736)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at com.citi.icg.rendition.util.MethodLoggingInterceptor.invoke(MethodLoggingInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:671)
at com.citi.icg.rendition.conversion.document.DocumentGenerator$$EnhancerBySpringCGLIB$$163bc93c.converttoJsonExternal()
at com.citi.icg.rendition.service.ConversionExecutor.convert(ConversionExecutor.java:101)
at com.citi.icg.rendition.service.ConversionExecutor.main(ConversionExecutor.java:36)
Caused by: com.aspose.imaging.internal.Exceptions.InvalidOperationException: Cannot find any fonts installed on the system.
at com.aspose.imaging.internal.Y.j.a(Unknown Source)
at com.aspose.imaging.internal.Y.j.a(Unknown Source)
at com.aspose.imaging.internal.Y.j.a(Unknown Source)
at com.aspose.imaging.internal.eQ.b.a(Unknown Source)
at com.aspose.imaging.internal.eO.b.e(Unknown Source)
at com.aspose.imaging.internal.eO.b.a(Unknown Source)
at com.aspose.imaging.internal.eO.b.a(Unknown Source)
at com.aspose.imaging.internal.eN.c.a(Unknown Source)
at com.aspose.imaging.internal.dV.q.a(Unknown Source)
at com.aspose.imaging.internal.dV.q.a(Unknown Source)
at com.aspose.imaging.internal.dV.q.a(Unknown Source)
at com.aspose.imaging.internal.dV.q.a(Unknown Source)
at com.aspose.imaging.internal.dV.D.b(Unknown Source)
at com.aspose.imaging.internal.dV.a.a(Unknown Source)
at com.aspose.imaging.internal.dV.a.export(Unknown Source)
… 49 common frames omitted

images.zip (129.1 KB)


#2

@gm69267,

I have observed the issue shared by you and suggest you to please first try using latest Aspose.Imaging for Java 18.9 on your end. If there is still an issue then please share the Operating System and Java details on your end. Please also ensure if the fonts used in your EMF are availble on machine where you are performing conversion.


#3

Hello there,

We have tried 18.9 but still have the same issue. Could you please add the font details to the exception log trace ?

OS details -
$ uname -a
Linux icgappuat01 2.6.18-419.el5 #1 SMP Wed Feb 22 22:40:57 EST 2017 x86_64 x86_64 x86_64 GNU/Linux


#4

@gm69267,

I have worked with the issue shared by you and have created in our issue tracking system with ID IMAGINGJAVA-1098 in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.


#5

Hi there,

Issue looks to be beyond what is there in the log messages.

We have logged the existing fonts in the system and fonts used in the EMF/SVG and also missing fonts.

We could see the fonts used in EMF are part of the fonts list installed in the system. Below are code snippets and log messages.

//Code snippet used to log fonts used in the EMF file
EmfMetafileImage emfMetafileImage = new EmfMetafileImage(bis);
try{
logger.info(“UsedFonts:{}”, Arrays.asList(emfMetafileImage.getUsedFonts()));
logger.info(“MissedFonts:{}”, Arrays.asList(emfMetafileImage.getMissedFonts()));
}
catch(Throwable e)
{
logger.warn(“Error while getting used/missed fonts:{}”, imageName, e);
}

//Above code printed below logs
2018-10-16 09:28:37,865| INFO|864572|ImageGenerationUtil|UsedFonts:[Arial, Arial Bold, Arial Italic, Arial Bold Italic]
2018-10-16 09:28:37,866| INFO|864572|ImageGenerationUtil|MissedFonts:[]

//Code snippet used to log fonts installed in the sysytem
GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
Font[] fontNames = graphicsEnvironment.getAllFonts();
for (Font s : fontNames) {
logger.warn("Fonts installed on the system {} ", s);
}

//Above code printed below logs
2018-10-16 09:28:36,522| WARN|864572|ImageGenerationUtil|Fonts installed on the system java.awt.Font[family=Arial,name=Arial,style=plain,size=1]
2018-10-16 09:28:36,522| WARN|864572|ImageGenerationUtil|Fonts installed on the system java.awt.Font[family=Arial Black,name=Arial Black,style=plain,size=1]
2018-10-16 09:28:36,522| WARN|864572|ImageGenerationUtil|Fonts installed on the system java.awt.Font[family=Arial,name=Arial Bold,style=plain,size=1]
2018-10-16 09:28:36,522| WARN|864572|ImageGenerationUtil|Fonts installed on the system java.awt.Font[family=Arial,name=Arial Bold Italic,style=plain,size=1]
2018-10-16 09:28:36,522| WARN|864572|ImageGenerationUtil|Fonts installed on the system java.awt.Font[family=Arial,name=Arial Italic,style=plain,size=1]
2018-10-16 09:28:36,522| WARN|864572|ImageGenerationUtil|Fonts installed on the system java.awt.Font[family=Arial Narrow,name=Arial Narrow,style=plain,size=1]
2018-10-16 09:28:36,522| WARN|864572|ImageGenerationUtil|Fonts installed on the system java.awt.Font[family=Arial Narrow,name=Arial Narrow Bold,style=plain,size=1]
2018-10-16 09:28:36,522| WARN|864572|ImageGenerationUtil|Fonts installed on the system java.awt.Font[family=Arial Narrow,name=Arial Narrow Bold Italic,style=plain,size=1]
2018-10-16 09:28:36,522| WARN|864572|ImageGenerationUtil|Fonts installed on the system java.awt.Font[family=Arial Narrow,name=Arial Narrow Italic,style=plain,size=1]
2018-10-16 09:28:36,522| WARN|864572|ImageGenerationUtil|Fonts installed on the system java.awt.Font[family=Arial Unicode MS,name=Arial Unicode MS,style=plain,size=1]


#6

@gm69267,

Thank you for sharing the additional details with us. We will get back to you as soon as the issue will be fixed.