Here is my code to convert the dwg to pdf:
public static void convert(String input_file, String output_file, float pageWidth, float pageHeight) throws Exception{
CadImage objImage = (CadImage) Image.load(input_file);
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
rasterizationOptions.setBackgroundColor(Color.getWhite());
rasterizationOptions.setPageWidth(pageWidth);
rasterizationOptions.setPageHeight(pageHeight);
rasterizationOptions.setExportAllLayoutContent(true);
rasterizationOptions.setLayouts(new String[] {“Model”});
// Iterate over the items of CadStyleDictionary
for (CadStyleTableObject style : (Iterable)objImage.getStyles())
{
// Set the font name
style.setPrimaryFontName(“Manjari-Thin.otf”);
}
PdfOptions pdfOptions = new PdfOptions();
pdfOptions.setVectorRasterizationOptions(rasterizationOptions);
objImage.save(output_file, pdfOptions);
}
I have ubuntu 18.04, I have this font in my local PC, the font path is /usr/share/fonts/opentype/malayalam/Manjari-Thin.otf. Should I specify the path to the font some where?