Hello Support team,
I am trying to do DWG to SVG conversion in LInux environment using aspose library, it is failing in LInux environment
From the code I need to do the conversion and as well as get the DWG file version.
Conversion is failing at this line
CadImage cadImage = (CadImage) image;
Here is the required details of the environment.
Amazon Linux 2023.6.20250218
fontconfig version 2.13.94
I am attaching conversion code and conversion logs
Please share your inputs to resolve the issue.
aspose tickets.zip (1.8 KB)
@shivanandtripathi
It appears you are encountering issues with DWG to SVG conversion in a Linux environment using the Aspose library. The error occurs when attempting to cast the image to CadImage. Here are some steps to troubleshoot and potentially resolve the issue:
-
Check Dependencies: Ensure that all necessary dependencies for Aspose.CAD are correctly installed in your Linux environment. Missing libraries can often lead to conversion failures.
-
Font Configuration: Since you are using fontconfig version 2.13.94, verify that the fonts required for rendering the DWG files are properly configured. You may need to install additional fonts or adjust font paths.
-
Review Conversion Logs: Examine the conversion logs for any specific error messages that could provide more insight into the failure. This information can be crucial for diagnosing the issue.
-
Sample Code: If possible, share a minimal version of your conversion code. This can help identify any potential issues in your implementation.
-
Contact Support: If the problem persists, consider reaching out to Aspose support with detailed logs and your environment setup for further assistance.
If you need further clarification or assistance, feel free to ask!
@shivanandtripathi,
Hello,
could you please attach also the initial DWG file so we can try to reproduce the problem directly?
Here I am attaching one sample DWG file
testdwgfile.zip (30.0 KB)
@shivanandtripathi,
thank you for details, we have created CADJAVA-12037 to investigate this issue.
Hello Support,
May I know the updates on this ticket,
Is this issue is happening due to some missing fonts, currently below fonts are installed on the server, please suggest if any new fonts has to be installed for DWG to SVG conversion.
/usr/share/fonts/dejavu-sans-fonts/DejaVuSans-ExtraLight.ttf: DejaVu Sans,DejaVu Sans Light:style=ExtraLight
/usr/share/fonts/dejavu-sans-mono-fonts/DejaVuSansMono-BoldOblique.ttf: DejaVu Sans Mono:style=Bold Oblique
/usr/share/fonts/dejavu-serif-fonts/DejaVuSerifCondensed-Bold.ttf: DejaVu Serif,DejaVu Serif Condensed:style=Condensed Bold,Bold
/usr/share/fonts/google-noto-vf/NotoSans[wght].ttf: Noto Sans:style=Medium
/usr/share/fonts/google-noto-vf/NotoSans[wght].ttf: Noto Sans:style=Regular
/usr/share/fonts/google-noto-vf/NotoSans-Italic[wght].ttf: Noto Sans:style=Italic
/usr/share/fonts/google-noto-vf/NotoSans[wght].ttf: Noto Sans
/usr/share/fonts/dejavu-sans-fonts/DejaVuSansCondensed.ttf: DejaVu Sans,DejaVu Sans Condensed:style=Condensed,Book
/usr/share/fonts/dejavu-sans-fonts/DejaVuSansCondensed-Bold.ttf: DejaVu Sans,DejaVu Sans Condensed:style=Condensed Bold,Bold
/usr/share/fonts/dejavu-serif-fonts/DejaVuSerif-Bold.ttf: DejaVu Serif:style=Bold
/usr/share/fonts/dejavu-sans-fonts/DejaVuSans-Oblique.ttf: DejaVu Sans:style=Oblique
/usr/share/fonts/dejavu-serif-fonts/DejaVuSerifCondensed-BoldItalic.ttf: DejaVu Serif,DejaVu Serif Condensed:style=Condensed Bold Italic,Bold Italic
/usr/share/fonts/google-noto-vf/NotoSans-Italic[wght].ttf: Noto Sans:style=SemiBold Italic
/usr/share/fonts/google-noto-vf/NotoSans-Italic[wght].ttf: Noto Sans
/usr/share/fonts/google-noto-vf/NotoSans[wght].ttf: Noto Sans:style=Bold
/usr/share/fonts/dejavu-sans-fonts/DejaVuSansCondensed-Oblique.ttf: DejaVu Sans,DejaVu Sans Condensed:style=Condensed Oblique,Oblique
/usr/share/fonts/google-noto-vf/NotoSans[wght].ttf: Noto Sans:style=SemiBold
/usr/share/fonts/dejavu-serif-fonts/DejaVuSerifCondensed.ttf: DejaVu Serif,DejaVu Serif Condensed:style=Condensed,Book
/usr/share/fonts/dejavu-serif-fonts/DejaVuSerif-Italic.ttf: DejaVu Serif:style=Italic
/usr/share/fonts/dejavu-sans-fonts/DejaVuSans-Bold.ttf: DejaVu Sans:style=Bold
/usr/share/fonts/dejavu-sans-fonts/DejaVuSans.ttf: DejaVu Sans:style=Regular,Book
/usr/share/fonts/dejavu-sans-fonts/DejaVuSans-BoldOblique.ttf: DejaVu Sans:style=Bold Oblique
/usr/share/fonts/dejavu-sans-mono-fonts/DejaVuSansMono.ttf: DejaVu Sans Mono:style=Regular,Book
/usr/share/fonts/dejavu-sans-fonts/DejaVuSansCondensed-BoldOblique.ttf: DejaVu Sans,DejaVu Sans Condensed:style=Condensed Bold Oblique,Bold Oblique
/usr/share/fonts/dejavu-serif-fonts/DejaVuSerifCondensed-Italic.ttf: DejaVu Serif,DejaVu Serif Condensed:style=Condensed Italic,Italic
/usr/share/fonts/google-noto-vf/NotoSans-Italic[wght].ttf: Noto Sans:style=Medium Italic
/usr/share/fonts/dejavu-serif-fonts/DejaVuSerif.ttf: DejaVu Serif:style=Regular,Book
/usr/share/fonts/dejavu-serif-fonts/DejaVuMathTeXGyre.ttf: DejaVu Serif,DejaVu Math TeX Gyre:style=Regular
/usr/share/fonts/dejavu-serif-fonts/DejaVuSerif-BoldItalic.ttf: DejaVu Serif:style=Bold Italic
/usr/share/fonts/google-noto-vf/NotoSans-Italic[wght].ttf: Noto Sans:style=Bold Italic
/usr/share/fonts/dejavu-sans-mono-fonts/DejaVuSansMono-Oblique.ttf: DejaVu Sans Mono:style=Oblique
/usr/share/fonts/dejavu-sans-mono-fonts/DejaVuSansMono-Bold.ttf: DejaVu Sans Mono:style=Bold
@shivanandtripathi,
Hi,
the issue is pending for the investigation, I will update this thread once I have more information.
@shivanandtripathi,
Hello,
we can not reproduce this issue in our environment. Could you please specify what version of Aspose.CAD you use, could you please try to create simple console application and provide exception details that Aspose.CAD throws? It could be helpful if you can attach this demo project here. The drawing uses Arial Narrow and Lucida Console fonts, could you please try to install them? Could you please also clarify why do you refer to fontconfig and its version, can you see any error relating to it?
Hello support team,
We are using aspose-cad 25.9 version jar file. I have already attached sample code in my initial post.
@shivanandtripathi,
Hi,
we are trying to reduce all side factors that may relate to this failure as we don’t see it directly, your code example works fine for us. That’s why we asked to do simple console project without tomcat, just Aspose.CAD
. There is no information about the exception that Aspose.CAD throws directly, now we can only guess about the possible reasons.
@shivanandtripathi,
we can not reproduce the issue on our end, please find the attached project example with result of conversion. Please note that I have removed jar file to reduce the file size.
console-app.zip (724.6 KB)
readme.docx (983.4 KB)
Hello Support team,
I added below line starting of the DWG to SVG conversion logic. Now conversion is working fine in Linux machine,
Locale.setDefault(new Locale("en", "US"));
But still I see below log lines in the middle - Any ide why this error is being printed in the middle.
7:05:24.420 [tomcat-handler-1355] DEBUG java.lang.ProcessBuilder - ProcessBuilder.start(): pid: 238, dir: null, cmd: “fc-match”
java.lang.RuntimeException: ProcessBuilder.start() debug
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1147)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1089)
at java.base/java.lang.Runtime.exec(Runtime.java:681)
at java.base/java.lang.Runtime.exec(Runtime.java:491)
at java.base/java.lang.Runtime.exec(Runtime.java:366)
at com.aspose.cad.internal.eH.b.b(Unknown Source)
@shivanandtripathi,
Hi,
thank you for sharing details. Unfortunately, we are almost helpless if we can not reproduce the issue and find the source of it directly.
Hi @oleksii.gorokhovatskyi ,
Some times I get "java.lang.OutOfMemoryError: Java heap space on server during conversion. I am doing the conversion for one file only.
Please suggest how to proceed further.
For successful conversion also it takes some times 10 to 15 seconds for DWG to SVG conversion, is there any way to reduce conversion time?
@shivanandtripathi,
this is very common error message, we need the entire Aspose.CAD stack trace to be able to find the reason. If you can localize any file throwing this, we may try to investigate it. The conversion time depends on the content of the file mostly, and can depend on the export settings. You may look at Quality option for CadRasterizationOptions object and decrease quality to make export faster. Again, if you upload sample file we can investigate why it requires this time and try to optimize. Commonly, 10-15 seconds seems to be fine.
Hi @oleksii.gorokhovatskyi ,
For few conversion I am getting below error . I am suspecting this issue is coming due to the missing .shx fonts. Please confirm.
I have added few more java code lines to print the font names in the logs. I am attaching the details logs in attachment.
Please also suggest from where (website) I can install these missing fonts at my linux machine.
“08:17:36.480 [java.lang.ThreadGroup[name=VirtualThreads,maxpri=10]_3] DEBUG java.lang.ProcessBuilder - ProcessBuilder.start(): pid: 89, dir: null, cmd: “/usr/bin/fc-list”
java.lang.RuntimeException: ProcessBuilder.start() debug
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1147)”
aspose dwg to svg conversion Nov 19.docx (13.1 KB)
@shivanandtripathi,
Hello,
We can confirm only when we can see the reason
Now we can only guess that this is because of fonts. Your log prints the information about styles, but the error message at Save that Aspose.CAD throws still not available, probably it could give some information. This should not be caused by SHX fonts missing, as library should not fail when the required fonts in drawing are missing, it should use existing OS fonts instead. You can try to install the TTF fonts that correspond to the initial SHX fonts mentioned in your logs: Simplex, Monotxt, Txt, Romans, as well as other basic fonts - Arial, DejaVu, Roboto, FreeMono, Droid Sans Fallback, please try if it changes something. We do not suggest any fonts source and do not deliver fonts, we use fonts already available.
Hi @oleksii.gorokhovatskyi ,
Here is the error, I got printed in the logs. Please suggest, what is the root cause of this failure.
t java.base/java.lang.Thread.run(Thread.java:1583)
13:24:01.639 [tomcat-handler-9] ERROR c.v.d.i.s.web.utils.ext.AsposeUtil - convertFileDWGToSVGFFormat: There was runtime error occurred in DWG to SVG conversionImage saving failed.
13:24:01.642 [tomcat-handler-9] ERROR c.v.d.i.s.web.utils.ext.AsposeUtil - convertFileDWGToSVGFFormat: printing stack trace[Ljava.lang.StackTraceElement;@57cd975b
13:24:01.643 [tomcat-handler-9] ERROR c.v.d.i.s.web.utils.ext.AsposeUtil - convertFileDWGToSVGFFormat: printing causeclass com.aspose.cad.cadexceptions.ImageSaveException: Image export failed. Neutral cultures cannot be used in formatting and parsing and therefore cannot be set as the thread’s current culture —> com.aspose.cad.internal.Exceptions.NotSupportedException: Neutral cultures cannot be used in formatting and parsing and therefore cannot be set as the thread’s current culture
— End of inner exception stack trace —
@shivanandtripathi,
Hi,
thank you, let us try to check this and come back.
@shivanandtripathi,
Hello,
this error relates to locale too. Please share sample file that throws “Neutral cultures cannot be used in formatting and parsing…” exception so we can try to reproduce. Is the locale setting you mentioned above appied for this case? If not - what is the locale?