Hi,
I’m using Aspose.CAD.dll, version 19.5, for transform dwg file in pdf file.
I have two problems:
-
the result file doesn’t preserve original fonts.
-
the result file is too big (original file is about 2mb, result is about 9mb): I also tried to decrease dpi but the result is the same
here I attach the code:
using (Aspose.CAD.Image image = Aspose.CAD.Image.Load(strSourceFile))
{
Aspose.CAD.ImageOptions.CadRasterizationOptions rasterizationOptions = new Aspose.CAD.ImageOptions.CadRasterizationOptions();
rasterizationOptions.PageHeight = 100;
rasterizationOptions.AutomaticLayoutsScaling = false;
rasterizationOptions.NoScaling = true;
// Create an instance of PdfOptions
Aspose.CAD.ImageOptions.PdfOptions pdfOptions = new Aspose.CAD.ImageOptions.PdfOptions();
// Set the VectorRasterizationOptions property
pdfOptions.VectorRasterizationOptions = rasterizationOptions;
//Export CAD to PDF
image.Save(sDestFile, pdfOptions);
}
@sviluppo.errevi
Can you please try using latest Aspose.CAD for .NET 20.8 on your end. In case there is still an issue please share the source DWG file along with generated PDF with us. Please also confirm that if the fonts used in your DWG file are actually available on your machine.
1 Like
for problem with font, you are probably right, the font used is “romans” which is a Autocad font.
for the size of the result file, i tryed version 20.8 but the problem persists.
I’ll send you source and destination file
@sviluppo.errevi
Please share the source and generated file along with snapshot highlighting issue and used sample code with us.
I attached the sample source file.
Result tile is too big to attach. yesterday I sent you a private link.
source.zip (1.7 MB)
This is the code I use:
image.png (24.4 KB)
after saving in pdf, the file is about 9Mb, the original is about 2Mb.
@sviluppo.errevi
I have created a ticket with ID CADNET-1216 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.
The issues you have found earlier (filed as CADNET-1216) have been fixed in this update.
@sviluppo.errevi
Aspose.CAD can render only build-in system fonts. Autocad also uses it’s own .shx fonts. If such font type appears we change it with a default font during the rendering process. The Rasterization option contains the “Quality” property. To reduce result pdf file size you can user the following parameters:
rasterizationOptions.Quality.ObjectsPrecision = RasterizationQualityValue.Low;
//the most influence option for result pdf file size
rasterizationOptions.Quality.Text = RasterizationQualityValue.Low;