I convert a dwg file to pdf, but the font in pdf is not what I want. How can I set the font. I have tried the following code, but does not work. And I can see the lines in the graph are too thick in the exported pdf. Can I also set the size of the line when converting dwg file to pdf file?
// Iterate over the items of CadStyleDictionary
for (CadStyleTableObject style : (Iterable)objImage.getStyles())
{
// Set the font name
style.setPrimaryFontName(“sans-serif.ttf”);
}
You need to please ensure that the fonts that have been referred in your application are actually available on your machine. You may please try using latest version on your end and if there is still an issue then please share the working sample code along with source file, generated output and used sample code with us.
// 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?
Please provide the source DWG file along with generated output PDF file. Please also share the snapshot of comparison between DWG and PDF where issue is exisiting.
Nothing wrong with the dwg file and the exported pdf. My purpose is to set customized font in the exported pdf. So I would like to know the right way to do that.
Ok, I could upload some example. The attachment files are screenshot of the font file Manjari-Thin.otf and the exported pdf. You can see that the exported pdf has different font. So I do not think the correct font is applied. How the aspose api knows the path of the font? Could you share a full example code to set font, including setting the path of the font. I tried to add path into setPrimaryFontName, but it does not work.
Please provide the source file, generated output file and desired output file along with used fonts. We will be able to investigate it further on our end on provision of requested information.