Hi,
As I was trying to convert DWG and DXF files containing text to PDF on a Linux server, I got this error:
com.aspose.cad.internal.Exceptions.InvalidOperationException: Cannot find any fonts installed on the system.
I’m using Aspose.CAD for Java 17.02.
Are there any requirements to execute such conversions on a Linux system ? Are there some packages or modules to be installed to provide fonts ? Is there a way to specify a font path to Aspose.CAD ? Which fonts should be installed ?
This error can be reproduced from your example files, with a modified version of ConvertDWGFileToPDF using the file sample_file.dwg (it contains labels):
public class ConvertDWGFileToPDF {
public static void main(String[] args) throws IOException {
// The path to the resource directory.
String dataDir = Utils.getDataDir(ConvertDWGFileToPDF.class) + “DWGDrawings/”;
String srcFile = dataDir + “sample_file.dwg”;
Image image = Image.load(srcFile);
// Create an instance of CadRasterizationOptions and set its various properties
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
rasterizationOptions.setBackgroundColor(Color.getWhite());
rasterizationOptions.setPageWidth(1600);
rasterizationOptions.setPageHeight(1600);
// Create an instance of PdfOptions
PdfOptions pdfOptions = new PdfOptions();
// Set the VectorRasterizationOptions property
pdfOptions.setVectorRasterizationOptions(rasterizationOptions);
// Export the DWG to PDF
image.save(new FileOutputStream(File.createTempFile(“sample_file_out_”,".pdf")), pdfOptions);
}
}
Hi,
Thanks for inquiring Aspose.CAD.
I have observed the issue and sample code shared by you. I request you to please provide the source DWG and DXF files with which you are having issue with. We will be able to investigate the issue further on our end on provision of requested information.
Many Thanks,
Hi,
I have worked with file shared by you using Aspose.Cad for JAVA 17.02 and have been able to observe the issue. A ticket with ID CADJAVA-121 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with issue so that you may be automatically notified once issue will be fixed.
We are sorry for your inconvenience,
Hi,
What is the current status of this issue ? I didn’t get notified about CADJAVA-121 since the last month. Do you have a scheduled date for a fix about it ?
Thank you.
Hi,
I have observed your comments. I like to inform that at present issue is still unresolved. I have also requested our product team to share further feedback regarding this issue. I request for your patience until further feedback is shared by our product team and issue gets resolved.
We are sorry for your inconvenience,
Hi,
I like to give answers of your following questions.
Are there any requirements to execute such conversions on a Linux system ?
You should to check next points:
- The fonts must are placed in next directories:
/usr/share/fonts,~/.fonts, /usr/local/share/fonts, /usr/X11R6/lib/X11/fonts
- Only TrueType fonts are supported.
Are there some packages or modules to be installed to provide fonts ?
No!
Is there a way to specify a font path to Aspose.CAD ?
Actually no.
The fonts must are placed in next directories:
/usr/share/fonts,~/.fonts, /usr/local/share/fonts, /usr/X11R6/lib/X11/fonts
Which fonts should be installed ?
- Only TrueType fonts are supported.
Please share feedback with us if there is still an issue.
Best Regards,
The issues you have found earlier (filed as ) have been fixed in this Aspose.Words for JasperReports 18.3 update.
@l.istin,
I like to inform that for CentOS Linux os. You need to install following
- fontconfig-devel
- TrueType fonts
Also Firstly check if command line fs-list returns list of TrueType fonts, if it does then the Aspose.Imaging for Java will work fine.